[FFmpeg-user] Best way to scale interlaced video
Massimo Battistel
battistel at gmail.com
Wed Feb 26 15:24:34 CET 2014
I've removed padding filter and audio track. The issue is still
reproducible.
You can download HD reference sample from here:
http://www.datafilehost.com/d/f8185302
This is the command line for solution #1:
ffmpeg -i sample1080i.mp4 -vcodec rawvideo -vf scale=w=720:h=432:interl=1
-an out_interl.avi
This is the command line for solution #2:
ffmpeg -i sample1080i.mp4 -vcodec rawvideo -vf
yadif=1:0,scale=w=720:h=432:interl=0,tinterlace=4 -an out_yadif.avi
To summarize:
Solution #1 should be the proper choice, but you'll notice horizontal lines
low definition compared to vertical ones.
Solution #2 gives better result for still video, but can produce
artifacts/moiré issues. Plus it takes more cpu (about 3 times).
Effect is more noticeable on an interlaced scan monitor, but you can see it
even on the progressive scan pc monitor.
Low-pass filter in tinterlace greatly reduces moiré effect, but image
looses definition and seems to be slightly out of focus...
This is the ffmpeg output for solution #1 (only scale with interl=1):
ffmpeg version N-59275-g9b195dd Copyright (c) 2000-2013 the FFmpeg
developers
built on Dec 21 2013 22:03:44 with gcc 4.8.2 (GCC)
configuration: --disable-static --enable-shared --enable-gpl
--enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib
--enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 58.101 / 52. 58.101
libavcodec 55. 45.103 / 55. 45.103
libavformat 55. 22.100 / 55. 22.100
libavdevice 55. 5.102 / 55. 5.102
libavfilter 4. 0.100 / 4. 0.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample1080i.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.22.100
Duration: 00:00:28.24, start: 0.033333, bitrate: 10094 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 9961 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
(default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Output #0, avi, to 'out_interl.avi':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
ISFT : Lavf55.22.100
Stream #0:0(und): Video: rawvideo (I420 / 0x30323449), yuv420p, 720x432
[SAR 16:15 DAR 16:9], q=2-31, 200 kb/s, 25 tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> rawvideo)
Press [q] to stop, [?] for help
frame= 84 fps=0.0 q=0.0 size= 38279kB time=00:00:03.40
bitrate=92229.3kbits/s
frame= 175 fps=174 q=0.0 size= 79741kB time=00:00:07.04
bitrate=92790.0kbits/s
frame= 267 fps=177 q=0.0 size= 121660kB time=00:00:10.72
bitrate=92969.7kbits/s
frame= 355 fps=177 q=0.0 size= 161755kB time=00:00:14.24
bitrate=93054.7kbits/s
frame= 443 fps=177 q=0.0 size= 201851kB time=00:00:17.76
bitrate=93106.0kbits/s
frame= 530 fps=176 q=0.0 size= 241491kB time=00:00:21.24
bitrate=93140.0kbits/s
frame= 620 fps=177 q=0.0 size= 282498kB time=00:00:24.84
bitrate=93165.2kbits/s
frame= 706 fps=177 q=0.0 Lsize= 321693kB time=00:00:28.28
bitrate=93186.4kbits/s
video:321671kB audio:0kB subtitle:0 global headers:0kB muxing overhead
0.006899%
...and the ffmpeg output for solution #2 (yadif and tinterlace):
ffmpeg version N-59275-g9b195dd Copyright (c) 2000-2013 the FFmpeg
developers
built on Dec 21 2013 22:03:44 with gcc 4.8.2 (GCC)
configuration: --disable-static --enable-shared --enable-gpl
--enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib
--enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 58.101 / 52. 58.101
libavcodec 55. 45.103 / 55. 45.103
libavformat 55. 22.100 / 55. 22.100
libavdevice 55. 5.102 / 55. 5.102
libavfilter 4. 0.100 / 4. 0.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample1080i.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.22.100
Duration: 00:00:28.24, start: 0.033333, bitrate: 10094 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 9961 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
(default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
Output #0, avi, to 'out_interl.avi':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
ISFT : Lavf55.22.100
Stream #0:0(und): Video: rawvideo (I420 / 0x30323449), yuv420p, 720x432
[SAR 16:15 DAR 16:9], q=2-31, 200 kb/s, 25 tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> rawvideo)
Press [q] to stop, [?] for help
frame= 84 fps=0.0 q=0.0 size= 38279kB time=00:00:03.40
bitrate=92229.3kbits/s
frame= 175 fps=174 q=0.0 size= 79741kB time=00:00:07.04
bitrate=92790.0kbits/s
frame= 267 fps=177 q=0.0 size= 121660kB time=00:00:10.72
bitrate=92969.7kbits/s
frame= 355 fps=177 q=0.0 size= 161755kB time=00:00:14.24
bitrate=93054.7kbits/s
frame= 443 fps=177 q=0.0 size= 201851kB time=00:00:17.76
bitrate=93106.0kbits/s
frame= 530 fps=176 q=0.0 size= 241491kB time=00:00:21.24
bitrate=93140.0kbits/s
frame= 620 fps=177 q=0.0 size= 282498kB time=00:00:24.84
bitrate=93165.2kbits/s
frame= 706 fps=177 q=0.0 Lsize= 321693kB time=00:00:28.28
bitrate=93186.4kbits/s
video:321671kB audio:0kB subtitle:0 global headers:0kB muxing overhead
0.006899%
thanks a lot to everyone,
MB
More information about the ffmpeg-user
mailing list