0

When I convert a video from MKV to MP4 using this command:

ffmpeg -i input.mkv -vcodec copy -acodec copy output.mp4

the frame rate mode changes from Constant to Variable, creating a desync over time in Adobe Premiere. Is there a way to keep the frame rate constant?

EDIT: Console Output from FFMPEG

F:\Recordings\Gameplay\Test>ffmpeg -i input.mkv -vcodec copy -acodec copy output.mp4
ffmpeg version N-82178-g60178e7 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil      55. 35.100 / 55. 35.100
libavcodec     57. 65.100 / 57. 65.100
libavformat    57. 57.100 / 57. 57.100
libavdevice    57.  2.100 / 57.  2.100
libavfilter     6. 66.100 /  6. 66.100
libswscale      4.  3.100 /  4.  3.100
libswresample   2.  4.100 /  2.  4.100
libpostproc    54.  2.100 / 54.  2.100
Input #0, matroska,webm, from 'input.mkv':
Metadata:
ENCODER         : Lavf57.41.100
Duration: 00:00:10.83, start: 0.000000, bitrate: 8834 kb/s
Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 1k fps, 60 tbr, 1k tbn, 120 tbc (default)
Metadata:
  DURATION        : 00:00:10.834000000
Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
Metadata:
  title           : Mic
  DURATION        : 00:00:10.797000000
Stream #0:2: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
Metadata:
  title           : Desktop
  DURATION        : 00:00:10.797000000
Stream #0:3: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
Metadata:
  title           : Discord
  DURATION        : 00:00:10.797000000
Output #0, mp4, to 'output.mp4':
Metadata:
encoder         : Lavf57.57.100
Stream #0:0: Video: h264 (Constrained Baseline) ([33][0][0][0] / 0x0021), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1k fps, 60 tbr, 16k tbn, 1k tbc (default)
Metadata:
  DURATION        : 00:00:10.834000000
Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo (default)
Metadata:
  title           : Mic
  DURATION        : 00:00:10.797000000
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  650 fps=0.0 q=-1.0 Lsize=   11681kB time=00:00:10.81    bitrate=8846.5kbits/s speed= 347x
video:11362kB audio:302kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.145660%

F:\Recordings\Gameplay\Test>pause
Press any key to continue . . .
5
  • What codecs are involved?
    – Daniel B
    Nov 7, 2016 at 22:00
  • 1
    You should show the complete console output from your command. Why do you think the output is VFR?
    – llogan
    Nov 8, 2016 at 2:11
  • Added Console Output, as for how I know, not only does MediaInfo show that frame rate as variable but in my editing software the audio desyncs overtime.
    – Tempest
    Nov 8, 2016 at 20:53
  • Can you provide a link to a sample input file?
    – llogan
    Nov 8, 2016 at 21:02
  • How should I go about doing that. Do you think it has something to do with the input file?
    – Tempest
    Nov 8, 2016 at 21:06

3 Answers 3

1

It changes to VFR because your original material (MKV) is actually VFR, just detected wrong. It is a very common problem among multiple libraries I have been working with.

Essentially, the concept of "framerate" does not exist in MKV container, let alone CFR/VFR. Instead, every single video frame has a timecode. Most of utilities (ffmpeg, mediainfo etc.) just use the timecodes to calculate the framerate as well as frame rate mode. For obvious performance concerns, They can't/don't read the whole file, so sometimes the info is off. You can use mkvextract to extract the timecodes of all the frames and calculate the interval between them across the whole video, to see if it's actually fully CFR or VFR.

0
-framerate XX

May need to specify with -r depending on input.

2
  • I tried both commands, the Frame rate was still variable after.
    – Tempest
    Nov 8, 2016 at 20:54
  • Then you may need to drop frames or specify target framerate. I am not at my pc right now but: man ffmpeg Should tell you
    – user657451
    Nov 8, 2016 at 23:38
0

Shadowplay captures are variable to begin with.

You'll have to re-encode using ffmpeg -i input.mkv -r 60 -acodec copy output.mp4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .