1

I have a VFR video (see media info below) which contains a mix of 24p and 30p video. The source of this video was a mixed-framerate DVD (Star Trek: Voyager) which has interlaced NTSC video CGI and composite scenes mixed with 24p filmed scenes. Many players can handle this video very well as it is, but my new TV does not honor the variable frame rate and forces all of the video into 24 fps, which causes severe judder in the 30 fps scenes.

I would like to use ffmpeg to convert this video to a constant 60fps (well, probably 59.94) so that the TV does not have to do it. I realize this involves a pull down. I am wondering if ffmpeg offers a combination of settings that will output a video file with 60fps without having to actually re-encode the video. I figure if that is possible, it would involve changing the timestamps on the frames. And the audio and subpicture streams need to be preserved as well.

Is that even possible?

Format                                   : Matroska
Format version                           : Version 2
File size                                : 407 MiB
Duration                                 : 45 min 55 s
Overall bit rate                         : 1 239 kb/s
Encoded date                             : UTC 2016-06-12T02:23:20Z
Writing application                      : HandBrake 0.10.5 2016021100
Writing library                          : Lavf55.12.0

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3
Format settings                          : CABAC / 5 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 5 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Bit rate                                 : 767 kb/s
Width                                    : 710 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 4:3
Frame rate mode                          : Variable
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : x264 core 142 r2479 dd79a61
Encoding settings                        : cabac=1 / ref=5 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=umh / subme=8 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / rc=crf / mbtree=1 / crf=20.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.601 NTSC
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.601

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : A_AC3
Duration                                 : 45 min 55 s
Bit rate mode                            : Constant
Bit rate                                 : 448 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Stream size                              : 147 MiB (36%)
Title                                    : Surround
Language                                 : English
Service kind                             : Complete Main
Default                                  : Yes
Forced                                   : No

Text
ID                                       : 3
Format                                   : VobSub
Codec ID                                 : S_VOBSUB
Codec ID/Info                            : Picture based subtitle format used on DVDs
Language                                 : English
Default                                  : No
Forced                                   : No

Menu
00:00:00.000                             : :Chapter 1
00:04:59.415                             : :Chapter 2
00:11:16.409                             : :Chapter 3
00:19:01.957                             : :Chapter 4
00:24:40.328                             : :Chapter 5
00:28:42.120                             : :Chapter 6
00:35:06.954                             : :Chapter 7
00:40:09.890                             : :Chapter 8

2

The answer is, "No." You can't do that. ffmpeg filters for framerate necessarily require the video stream to be re-encoded.

However, in my case, the solution was actually very simple. Although the video stream has a variable frame rate, the MKV header has a field for "default duration" which represents the "default" frame rate in nanoseconds per frame. Some players (at least the one in my TV) use this value to determine how the video is going to be played. In this case, though not shown by Mediainfo, the MKV has a default frame rate of 24 fps.

What I ended up doing was using mkvpropedit to change the default duration value to one that matches 59.94 fps. This worked to trick my LG CX into treating the video as 60 fps video. The 23.97 content still looks smooth, and when it shifts to 29.97, it stays smooth. I wrote a batch file to do this to all of the files in a folder at once, and it looks like this:

for /r %%i in (*.mkv) do mkvpropedit.exe "%%i" --edit track:v1 --set default-duration=16683333

16683333 is the duration, in nanoseconds, of a 59.94 framerate video frame. So basically, this causes the LG CX to expect 60 frames a second instead of just 24, so it doesn’t drop frames during 30fps content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.