DV to bob deinterlaced HEVC

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

DV to bob deinterlaced HEVC

Matti Haveri
My current plan to convert 4:3 PAL .dv to HEVC as a batch:

for i in *.dv; do ffmpeg -i "$i"
-vf bwdif=1,scale=788:576,crop=768:576:10:0,setsar=sar=1/1
-c:v libx265 -crf 18 -preset slow -tag:v hvc1
-c:a aac -b:a 128k "${i%.*}_converted.mp4"; done

In my tests bwdif has less artifacts than yadif.

I guess it is better to deinterlace first, then scale?

4:3 PAL .dv 720x576 (PAR 128/117) to square pixels:

a) scale to 788x576 then crop to 768x576 or:
b) crop to 702x576 then scale to 768x576

http://web.archive.org/web/20140218044518/http://lipas.uwasa.fi/~f76998/video/conversion/

I chose to scale, then crop because the different order
'crop=702:576:9:0,scale=768:576' produces the following alert
(maybe this is just a cosmetic issue?):

"[swscaler @ 0x1123e2000] Warning: data is not aligned!
This can lead to a speed loss"

I guess it doesn't matter in which order libx265 options -crf, -preset
etc are?

CRF 18-20(-22) seems like a sweet spot. CRF 24 or higher produce very
ugly artifacts to noisy parts of the footage.

There seems to be not much or any difference in quality between
-preset slow vs medium.

25fps vs 50fps difference is there but not so great as I expected.

- Matti
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: DV to bob deinterlaced HEVC

Carl Eugen Hoyos-2
Am Do., 12. Nov. 2020 um 20:11 Uhr schrieb Matti Haveri
<[hidden email]>:

> I guess it is better to deinterlace first, then scale?

This is correct.

I am not aware of any advantage of square pixels atm, not
scaling (if this is possible) should be preferable.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: DV to bob deinterlaced HEVC

Mark Filipak (ffmpeg)
In reply to this post by Matti Haveri
On 11/12/2020 02:10 PM, Matti Haveri wrote:

> My current plan to convert 4:3 PAL .dv to HEVC as a batch:
>
> for i in *.dv; do ffmpeg -i "$i"
> -vf bwdif=1,scale=788:576,crop=768:576:10:0,setsar=sar=1/1
> -c:v libx265 -crf 18 -preset slow -tag:v hvc1
> -c:a aac -b:a 128k "${i%.*}_converted.mp4"; done
>
> In my tests bwdif has less artifacts than yadif.
>
> I guess it is better to deinterlace first, then scale?
>
> 4:3 PAL .dv 720x576 (PAR 128/117) to square pixels:
>
> a) scale to 788x576 then crop to 768x576 or:
> b) crop to 702x576 then scale to 768x576
>
> http://web.archive.org/web/20140218044518/http://lipas.uwasa.fi/~f76998/video/conversion/
>
> I chose to scale, then crop because the different order
> 'crop=702:576:9:0,scale=768:576' produces the following alert
> (maybe this is just a cosmetic issue?):
>
> "[swscaler @ 0x1123e2000] Warning: data is not aligned!
> This can lead to a speed loss"
>
> I guess it doesn't matter in which order libx265 options -crf, -preset
> etc are?
>
> CRF 18-20(-22) seems like a sweet spot. CRF 24 or higher produce very
> ugly artifacts to noisy parts of the footage.
>
> There seems to be not much or any difference in quality between
> -preset slow vs medium.
>
> 25fps vs 50fps difference is there but not so great as I expected.
>
> - Matti
Do some research, Matti. If the PAL DVD is a movie, note its running time and compare to an NTSC DVD
or Blu-ray running time. If the PAL DVD running time is 4% fast, then the video is actually p24. For
movies, that's almost always the case. If so, try forcing 24FPS and let me know how it goes. If the
video is okay (and it probably will be), then you will need to extract the audio, subs, and chapters
separately, stretch them by 25/24, and merge them with the video -- you could try mkvmerge (or
MKVToolNixGUI). Again, let me know how it goes.

Regards,
Mark.

--
11 Nov 2020 -- early in the pandemic.
Yesterday's new cases, China: 17, S.Korea: 146, U.S.: 142,906.
Yesterday's new deaths, China: 0, S.Korea: 2, U.S.: 1,479.
Today, U.S.: 4% of world population, 20% of cases, 19% of deaths.
Today, U.S. mortality: Of 7,143,501 resolved cases, 4% are dead.
Today, U.S. dead, pandemic: 247,398 (9 mo.), WWII: 419,000 (47 mo.).
Today, U.S. total cases: 3.2%. To reach herd immunity: at least 60%.
2021+ (no vaccine), U.S. reaches herd immunity, 8-million U.S. dead.
22 Jan: U.S. & S.Korea report 1st cases on the same day.
  6 Mar, testing to date, S.Korea: 140,000, U.S.: 2000.
  6 Mar, test results, S.Korea: 4 hours, U.S.: 1 to 2 weeks.
  1 Jun, total care-home deaths, S.Korea: 0, U.S.: 33,000 +/- 7,000.
  5 Aug, U.S. testing: only 1/4 of number needed; 4 day results.
  1 Sep, Nursing Assoc report: Over 60% of U.S. nurses lack PPE.
18 Sep, U.S. doctors & nurses still acutely lack PPE; 1200 dead.
15 Oct, projected GDP, China: up 1.9%, U.S.: down 3.6%.
19 Oct, CDC report: U.S. test results still take 3 days, average.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: DV to bob deinterlaced HEVC

Matti Haveri
In reply to this post by Carl Eugen Hoyos-2
On Thu, Nov 12, 2020 at 11:39 PM Carl Eugen Hoyos <[hidden email]>
wrote:

> > I guess it is better to deinterlace first, then scale?
>
> This is correct.
>

I tested to scale & crop first, and then deinterlace, and to my surprise
the output was identical.
Maybe because only horizontal scaling was done.

These are home DV movies shot with an unnEUterized Sony TRV320E and old VHS
digitized
with it. Several years ago I converted them all to deinterlaced H.264 with
simple deinterlace.
That quality is OK but I plan to re-encode those archived .dv files again
with bob deinterlace
as H.265 with smoother motion and slightly better quality with about the
same or little larger
file size.

Some noisy DV scenes need CRF below 22. I tried to search noise reduction
filters but
maybe I just use CRF 18-20 for all material. The old VHS footage compresses
well with
bitrate automatically adjusted quite low with CRF 18 and even CRF 24 is OK
with it.

- Matti
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: DV to bob deinterlaced HEVC

Carl Eugen Hoyos-2
Am Fr., 13. Nov. 2020 um 10:44 Uhr schrieb Matti Haveri
<[hidden email]>:

>
> On Thu, Nov 12, 2020 at 11:39 PM Carl Eugen Hoyos <[hidden email]>
> wrote:
>
> > > I guess it is better to deinterlace first, then scale?
> >
> > This is correct.
>
> I tested to scale & crop first, and then deinterlace, and to my surprise
> the output was identical.

While it may look similar (because only horizontal scaling was done),
I don't think the output was identical.
Both scaling and deinterlacing cannot be undone and do have an
impact on quality (if you define quality as identity with a - possibly
hypothetical - original).
I can understand why you want to deinterlace, you should avoid
the scaling (unless I miss something and you absolutely have to
do it).

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: DV to bob deinterlaced HEVC

FFmpeg-users mailing list
25fps vs 50fps difference is there but not so great as I expected.

You might find that ffmpeg is duplicating each deinterlaced frame to output 50fps from the 25fps source. If you use yadif filter and configure to output a frame per field of interlaced source the resulting motion is dramatically improved at the expense of vertical resolution.
Depending on the content type this option might be preferable.

Thanks
Adam

> On 13 Nov 2020, at 19:40, Carl Eugen Hoyos <[hidden email]> wrote:
>
> Am Fr., 13. Nov. 2020 um 10:44 Uhr schrieb Matti Haveri
> <[hidden email]>:
>>
>> On Thu, Nov 12, 2020 at 11:39 PM Carl Eugen Hoyos <[hidden email]>
>> wrote:
>>
>>>> I guess it is better to deinterlace first, then scale?
>>>
>>> This is correct.
>>
>> I tested to scale & crop first, and then deinterlace, and to my surprise
>> the output was identical.
>
> While it may look similar (because only horizontal scaling was done),
> I don't think the output was identical.
> Both scaling and deinterlacing cannot be undone and do have an
> impact on quality (if you define quality as identity with a - possibly
> hypothetical - original).
> I can understand why you want to deinterlace, you should avoid
> the scaling (unless I miss something and you absolutely have to
> do it).
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: DV to bob deinterlaced HEVC

Matti Haveri
On Sun, Nov 15, 2020 at 2:00 PM adam smith via ffmpeg-user <
[hidden email]> wrote:
>> 25fps vs 50fps difference is there but not so great as I expected.
> You might find that ffmpeg is duplicating each deinterlaced frame to
> output 50fps from the 25fps source.

Most of the footage was interlaced and the .mp4 output had
unique frames.

There were a only a few scenes where the camcorder's shutter speed was
slower than 1/25s so those parts were progressive i.e. no comb lines
in original .dv files and there were duplicate frames in the .mp4
output.

I also tried to disable all motion smoothing options off in the
television while evaluating the quality. I also compared two
windows on a computer monitor.

yadif and bwdif were set to output one frame for each field. I found
bwdif somewhat better than yadif which leaves some minor "ripple"
artifacts to the movie.

BTW, I guess I could skip scaling and set the output .mp4 pixel aspect
ratio the same as in the input PAL .dv 128/117 but I prefer to convert to
square pixels.

- Matti
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: DV to bob deinterlaced HEVC

Carl Eugen Hoyos-2
Am So., 15. Nov. 2020 um 14:36 Uhr schrieb Matti Haveri
<[hidden email]>:

> BTW, I guess I could skip scaling and set the output .mp4 pixel aspect
> ratio the same as in the input PAL .dv 128/117 but I prefer to convert to
> square pixels.

You should simply not set it.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: DV to bob deinterlaced HEVC

FFmpeg-users mailing list
> yadif and bwdif were set to output one frame for each field. I found bwdif somewhat better than yadif which leaves some minor "ripple" artifacts to the movie.

Thanks for the comparison advice, I will take a look at the bwdif filter.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: DV to bob deinterlaced HEVC

Matti Haveri
In reply to this post by Carl Eugen Hoyos-2
I was surprised when macOS 11.0 Big Sur QuickTime Player seemed to
indicate that a mp4 converted from .dv started at 00:25:16 until
I noticed it defaulted displaying the SMPTE Timecode.

I did some quick tests with ffmpeg:

Adding '-timecode 00:00:00:00' (after the -preset slow if that
matters) to the encoding command seemed to set the starting
point at zero. And using '-write_tmcd off' seemed to omit the
timecode (and some related tags) completely.

Which approach would you suggest? I have never put any attention
to the timecode and I guess this is only a cosmetic issue.
But this is a big project so I would like to do it correctly.

At the moment I don’t know whether preserving the existing
timecodes would bring any benefits. These are old DV home movies
edited with iMovie and exported as up to 9 minute 27 sec .dv
clips (i.e. old iMovie versions max 2 GB clip size) to the
archive. I guess the timecode in those .dv files might be
a remnant of the old original clip that happened to start
that .dv file?

for i in *.dv; do ffmpeg -i "$i" -vf
bwdif=1,scale=788:576,crop=768:576:10:0,setsar=sar=1/1 -c:v libx265 -crf 18
-preset slow -timecode 00:00:00:00 -tag:v hvc1 -c:a aac -b:a 128k
"${i%.*}_converted.mp4"; done

- Matti
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".