How to convert 1080@50i -> 720@50p using ffmpeg?
Solution 1
"For most practical cases it is not possible to retrieve a complete progressive video from interlaced content."
Also if you could upload a small sample of the video, it would help your cause tremedously.
Source: mplayerhq.hu/DOCS/HTML/en/menc-feat-telecine.html
Solution 2
Just like interlacing progressive content divides each frame into 2 fields, thus doubling the frame rate, the common method of deinterlacing is to combine each 2 fields into 1 frame, which reduces the rate by 2, thus taking 50 into 25fps. You can of course double each final frame, but that does not provide any benefit.
First, we can read not to use -deinterlace, and yadif instead (which you already do):
- deinterlace This option is deprecated since the deinterlacing is very low quality. Use the yadif filter with -filter:v yadif.
You'll probably find the the yadif section of the FFMPEG documentation pretty interesting:
Deinterlace the input video ("yadif" means "yet another deinterlacing filter").
It accepts the optional parameters: mode:parity:auto.
MODE specifies the interlacing mode to adopt, accepts one of the following values:
‘0’
output 1 frame for each frame
‘1’
output 1 frame for each field
‘2’
like 0 but skips spatial interlacing check
‘3’
like 1 but skips spatial interlacing check
Default value is 0.
PARITY default value is -1.
AUTO default value is 0.
Notice how the default MODE is 0, which instructs FFMPEG to ouput 1 frame for each 2 fields, thus halving the fps. I think what you're looking for is MODE 1: one frame per field. I'm not too sure how to use these optional parameters but perhaps something like
-filter:v yadif 1:-1:0 -s "1280x720" -r 50
Solution 3
ffmpeg -i input.avi -deinterlace -filter:v yadif -s "1280x720" output.avi
Solution 4
According to the documentation, the -r
option sets the output file frames per second. For example, this sets the output to 50 frames per second:
ffmpeg -i input.avi -r 50 output.avi
Related videos on Youtube
BarsMonster
Software/Hardware geek, Microelectronics, Optics, Lasers and Holography. My personal blog is at 3.14.by I do some microchip photography at zeptobars.com
Updated on September 17, 2022Comments
-
BarsMonster almost 2 years
I really like 50fps video, but I cannot make ffmpeg convert it to 50fps for me.
720p resolution is absolutely fine with me, just need more FPS.
50i just looks much smoother in proper players (for example GOM Player deinterlaces video and plays it at 50Hz. Very big difference to 25Hz video.)...
My current command line is:
ffmpeg -i 00010.MTS -threads 3 -filter:v yadif -s "1280x720" -r 50 -b:v 20M output.avi
Here are more video details. Source video is from Cannon HF10 AVCHD camcoder.
ffmpeg -i 00010.MTS -threads 3 -filter:v yadif -s "1280x720" -r 50 -b:v 20M output.avi ffmpeg version N-37541-g670229e Copyright (c) 2000-2012 the FFmpeg developers built on Feb 3 2012 20:14:17 with gcc 4.6.2 configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-ru ntime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --en able-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger - -enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwben c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable- libxvid --enable-zlib libavutil 51. 37.100 / 51. 37.100 libavcodec 54. 0.102 / 54. 0.102 libavformat 54. 0.100 / 54. 0.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 61.100 / 2. 61.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 6.100 / 0. 6.100 libpostproc 52. 0.100 / 52. 0.100 [h264 @ 000000000033FA30] Increasing reorder buffer to 1 Input #0, mpegts, from '00010.MTS': Duration: 00:03:13.92, start: 0.482156, bitrate: 16304 kb/s Program 1 Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p, 1920x1 080 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 50 tbc Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, s16, 256 kb/s File 'output.avi' already exists. Overwrite ? [y/N] y w:1920 h:1080 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param: [yadif @ 0000000003CE95B0] mode:0 parity:-1 auto_enable:0 [scale @ 0000000003CE9550] w:1920 h:1080 fmt:yuv420p -> w:1280 h:720 fmt:yuv420p flags:0x4 Output #0, avi, to 'output.avi': Metadata: ISFT : Lavf54.0.100 Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1280x720 [SAR 1:1 DA R 16:9], q=2-31, 20000 kb/s, 50 tbn, 50 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16, 128 kb /s Stream mapping: Stream #0:0 -> #0:0 (h264 -> mpeg4) Stream #0:1 -> #0:1 (ac3 -> libmp3lame) Press [q] to stop, [?] for help frame= 15 fps= 0 q=2.0 size= 945kB time=00:00:00.62 bitrate=12481.3kbits/ frame= 32 fps= 32 q=2.0 size= 2132kB time=00:00:01.30 bitrate=13435.2kbits/ frame= 51 fps= 34 q=2.0 size= 3372kB time=00:00:02.06 bitrate=13409.2kbits/ frame= 70 fps= 35 q=2.0 size= 4641kB time=00:00:02.82 bitrate=13482.8kbits/ frame= 76 fps= 35 q=2.0 Lsize= 5047kB time=00:00:03.06 bitrate=13511.9kbits
-
Admin over 13 yearsWhat do you mean, 'cannot make'? Does it give you errors?
-
Admin over 13 yearsIt produces file, which looks like 25p, not as smoooth as 50i in proper player.
-
Admin over 12 years@slhck Here it goes
-
Admin over 12 yearsAny specific reason for encoding to MPEG-4 Visual instead of using h.264 again (e.g.
-vcodec libx264
? Not that it should matter that much at ~20 MBit/s, but still. -
Admin over 12 years@slhck well, it's just default :-)
-
Admin over 12 yearsWhat happens if you use ffmpeg with "-r 100" ? Why don't you use mencoder with
-vf scale=width:height
? -
Admin over 12 yearsWell, in mediainfo file have 100 FPS, but I am still getting just 25 FPS on the player. When stepping frame by frame it's exactly 25 FPS.
-
Admin over 12 yearsDoes mencoder manage to do a better job of driving ffmpeg ?
-
-
BarsMonster over 13 yearsUnfortunately, the file produced is about the same as for -r 25. And it's not longer smoooth. It looks like it just took 25p video, and then framedoubled it.
-
Just Jake over 13 yearsHave you tried specifying input framerate as well?
-
Jason over 12 yearsThat is excpeted. When you deinterlace video you sacrifice smooth motion for compatibly with progressive displays.
-
BarsMonster over 12 yearsUnfortunately, it still produced just 25 fps output... Original file is way way smoother.... Even adding -r 50 didn't helped.
-
BarsMonster over 12 years@Jason Well, my videoplayer (GOM Player) deinterlaces 50i video, and shows it smoothly (i.e. at 50Hz) on my 120Hz TFT monitor, which is obviously progressive. Why can't video recoder do the same thing, and produce smooth 50Hz output? I understand that 50i have less small details, but why can't I expect to get 50Hz output?
-
slhck over 12 yearsIt depends on the deinterlacing filter used. Obviously GOM Player does a good job at this. Don't know too much about how FFmpeg handles interlaced video though. @BarsMonster
-
BarsMonster over 12 yearsAt least it gives 50 fps output, but unfortunately 2 sequential frames generated are very similar... While when I step original 50i video frame by frame I really see that fast motion have twice more 'steps', and much smoother.
-
mtone over 12 years@BarsMonster First, I'd try to find out what GOM player does, in case it's due to some form of interpolation. I'm curious - is there that much interlaced content that contains high-fps information? (After all, converting a 25p to 50i for broadcasting does not create any new motion information - you need straigth-to-interlaced content). Next, if you do find a deinterlacting technique that GOM uses (see wikipedia, there are quite a few), you should try to find a filter for it that can be used in AVISYNTH as part of the process instead of using FFMPEG's -YADIF method.