I am trying to convert some MKV to MP4 with ffmpeg, and I keep getting the error below. Any thoughts?
I have installed ffmpeg and installed:
sudo apt install -y libopus-dev libmp3lame-dev libfdk-aac-dev libvpx-dev libx264-dev yasm libass-dev libtheora-dev libvorbis-dev mercurial cmake
Command I ran with output:
ffmpeg -i 'video.mkv' -codec copy 'video.mp4' -strict -2 -y
ffmpeg version 4.0.2-2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8 (Ubuntu 8.2.0-7ubuntu1)
configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
[mp4 @ 0x560e85326100] track 1: codec frame size is not set
[mp4 @ 0x560e85326100] opus in MP4 support is experimental, add '-strict -2' if you want to use it.
Could not write header for output file #0 (incorrect codec parameters ?): Experimental feature
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Last message repeated 1 times
I also tried adding -strict -2
to no avail.
The order of options is important:
ffmpeg [global options] [input options] -i input [output options] output
Your example has trailing options which are often ignored.
In your case you are trying to mux Opus audio into the MP4 container, but outdated versions of ffmpeg
consider this to be experimental. So you have to add -strict experimental
or -strict -2
. Use:
ffmpeg -y -i 'video.mkv' -codec copy -strict -2 'video.mp4'
Recent versions (FFmpeg 4.3 and newer & the git master branch) no longer need -strict -2
/ -strict experimental
to mux Opus into MP4:
ffmpeg -y -i 'video.mkv' -codec copy 'video.mp4'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With