FFMPEG Converting MKV to MP4 causes Frame Rate Mode to Change

0

1

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 . . .

Tempest

Posted 2016-11-07T21:49:25.103

Reputation: 1

What codecs are involved? – Daniel B – 2016-11-07T22:00:22.383

1You should show the complete console output from your command. Why do you think the output is VFR? – llogan – 2016-11-08T02:11:49.403

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 – 2016-11-08T20:53:20.293

Can you provide a link to a sample input file? – llogan – 2016-11-08T21:02:17.293

How should I go about doing that. Do you think it has something to do with the input file? – Tempest – 2016-11-08T21:06:42.940

Answers

0

-framerate XX

May need to specify with -r depending on input.

user657451

Posted 2016-11-07T21:49:25.103

Reputation: 268

I tried both commands, the Frame rate was still variable after. – Tempest – 2016-11-08T20:54:02.490

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 – 2016-11-08T23:38:59.473

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

Gyan

Posted 2016-11-07T21:49:25.103

Reputation: 21 016

0

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

You can use mkvextract to extract the timecodes of every frame and calculate the interval between to see if it's true or not.

fireattack

Posted 2016-11-07T21:49:25.103

Reputation: 1