Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting MKV to MP4

Tags:

ffmpeg

mp4

mkv

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?

like image 653
Bwicks Avatar asked Aug 31 '20 04:08

Bwicks


People also ask

Can you convert MKV to MP4 without losing quality?

With Movavi Video Converter, you can transfer MKV to MP4 without losing quality using the revolutionary SuperSpeed mode. The program supports batch processing that makes conversion even faster. You can also use this smart software to convert MP4 to MKV.

Can you convert MKV to MP4 online?

CloudConvert converts your video files online. Amongst many others, we support MP4, WEBM and AVI. You can use the options to control video resolution, quality and file size.


1 Answers

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"
like image 186
Gyan Avatar answered Sep 18 '22 10:09

Gyan