I've been using ffmpeg to convert mkv to mp4 and the following is the command I used.
ffmpeg -i demo.mkv -vcodec libx264 -vprofile high -crf 28 -c:v h264 demo.mp4
But now I got errors when I tried to convert a new mkv file. I've done quite extensive search online, but so far I haven't been able to find a solution.
The following are screen outputs, which include version and library info.
ffmpeg version N-101385-gb34d1de Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
configuration: --enable-gpl --enable-nonfree --enable-libx264 --enable-libmp3lame --enable-libass
libavutil 56. 66.100 / 56. 66.100
libavcodec 58.128.100 / 58.128.100
libavformat 58. 70.100 / 58. 70.100
libavdevice 58. 12.100 / 58. 12.100
libavfilter 7.107.100 / 7.107.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100 libpostproc 55. 8.100 / 55. 8.100
[av1 @ 0x2e66180] Your platform doesn't suppport hardware accelerated AV1 decoding.
[av1 @ 0x2e66180] Failed to get pixel format.
[av1 @ 0x2e66180] Missing Sequence Header.
Last message repeated 122 times [av1 @ 0x2e66180] video_get_buffer: image parameters invalid
[av1 @ 0x2e66180] get_buffer() failed
[av1 @ 0x2e66180] thread_get_buffer() failed
[av1 @ 0x2e66180] Failed to allocate space for current frame.
[av1 @ 0x2e66180] Get current frame error
[matroska,webm @ 0x2e62580] decoding for stream 0 failed
[matroska,webm @ 0x2e62580] Could not find codec parameters for stream 0 (Video: av1 (Main), none(tv, bt709), 1920x1072 [SAR 1:1 DAR 120:67]): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from 'demo.mkv':
Metadata:
COMPATIBLE_BRANDS: iso6av01mp41
MAJOR_BRAND : dash
MINOR_VERSION : 0
ENCODER : Lavf58.70.100
Duration: 00:13:39.08, start: -0.007000, bitrate: 779 kb/s
Stream #0:0: Video: av1 (Main), none(tv, bt709), 1920x1072 [SAR 1:1 DAR 12 0:67], 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
Metadata:
HANDLER_NAME : ISO Media file produced by Google Inc.
VENDOR_ID : [0][0][0][0]
DURATION : 00:13:39.000000000
Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Metadata:
DURATION : 00:13:39.081000000
Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 0, only the last option '-c:v h264' will be used.
Stream mapping:
Stream #0:0 -> #0:0 (av1 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
[av1 @ 0x2e6ad40] Your platform doesn't suppport hardware accelerated AV1 decoding.
[av1 @ 0x2e6ad40] Failed to get pixel format.
Error while decoding stream #0:0: Function not implemented
[av1 @ 0x2e6ad40] Missing Sequence Header.
Error while decoding stream #0:0: Invalid data found when processing input
... [the above two lines repeated dozens of times]
[av1 @ 0x2e6ad40] video_get_buffer: image parameters invalid
[av1 @ 0x2e6ad40] get_buffer() failed
[av1 @ 0x2e6ad40] thread_get_buffer() failed
[av1 @ 0x2e6ad40] Failed to allocate space for current frame.
[av1 @ 0x2e6ad40] Get current frame error
Error while decoding stream #0:0: Invalid argument
... [the above 6 lines repeated hundreds of times]
[av1 @ 0x2e6ad40] Failed to get reference frame.
Error while decoding stream #0:0: Invalid argument
Cannot determine format of input stream 0:0 after EOF
Error marking filters as finished
[aac @ 0x2ed0f00] Qavg: 3268.314
[aac @ 0x2ed0f00] 2 frames left in the queue on closing
Conversion failed!
Note that the three dots (...) indicate omitted lines which repeated numerous times. Any help is appreciated.
Your input video stream uses AV1
codec, and as the log says,
Your platform doesn't suppport hardware accelerated AV1 decoding.
You will need a ffmpeg build with support of an AV1 decoder such as libdav1d
. Available at https://johnvansickle.com/ffmpeg/