9

So I am trying to convert a really long video from MKV to MP4. I tried this command first which is supposed to be the fastest way to convert mkv to mp4

ffmpeg -i "vid.mkv" -codec copy -map 0 "MP4/vid.mp4"

however I am getting this error everytime I run it

[mp4 @ 0x7fffe98ae500] track 1: codec frame size is not set
[mp4 @ 0x7fffe98ae500] 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

What am I doing wrong?

Jheems
  • 300
  • 1
  • 4
  • 11

1 Answers1

20

The issue and solution is mentioned in the 2nd line of the excerpt you pasted.

You're using an older version of ffmpeg. Since recently, Opus audio in MP4 is no longer treated as experimental. Upgrade to ffmpeg 4.3 or add -strict -2 as mentioned in log.

For compatibility sake, you'll usually want to transcode audio to AAC.

ffmpeg -i "vid.mkv" -map 0 -c copy -c:a aac "MP4/vid.mp4"
Gyan
  • 85,394
  • 9
  • 169
  • 201
  • 1
    I tried to use the command you suggested and it worked for some reason and I am able to convert the video to mp4. Thanks – Jheems Aug 31 '20 at 12:00