1

I am trying to convert .mkv to .mp4 Following is the my terminal. I get an error saying

Cannot find H264 start code. Error importing video.h264: BitStream Not Compliant

gayan@GayanF:~/Videos/converted$ mkvmerge --identify file.mkv
File 'file.mkv': container: Matroska
Track ID 0: video (VP9)
Track ID 1: audio (AAC)
Global tags: 1 entry
Tags for track ID 0: 2 entries
Tags for track ID 1: 4 entries

gayan@GayanF:~/Videos/converted$ mkvextract tracks file.mkv 0:video.h264 1:audio.ac3
Extracting track 0 with the CodecID 'V_VP9' to the file 'video.h264'. Container format: IVF
Extracting track 1 with the CodecID 'A_AAC' to the file 'audio.ac3'. Container format: raw AAC file with ADTS headers
Progress: 100%
gayan@GayanF:~/Videos/converted$ MP4Box -fps 24 -add video.h264 -add audio.ac3 video.mp4
Cannot find H264 start code
Error importing video.h264: BitStream Not Compliant
  • 3
    Would you be happy to use FFmpeg rather than your current methods? If so something like the following should suffice: ffmpeg -i file.mkv -c:v libx264 -preset slow -crf 22 -c:a copy video.mp4 – andrew.46 Jun 16 '18 at 7:00
  • @andrew.46 thank you so much. I tried ffmpeg earlier and failed to do that. But with your command it was successfull. Many thanks to you. You saved my time. Thank you mate!!!! – Gayan Fernando Jun 16 '18 at 9:49
  • Hi @andrew.46 , I am trying to convert another .mkv to .mp4. But it gives an error saying "[mp4 @ 0x183f980] Codec for stream 1 does not use global headers but container format requires global headers [mp4 @ 0x183f980] Could not find tag for codec opus in stream #1, codec not currently supported in container" – Gayan Fernando Jun 16 '18 at 10:20
  • Best for your second file that you add the details to your original question. Show the codecs in the second file by running the command ffmpeg -i filename where 'filename' is changed to the actual filename of your input file. If we can reach a happy resolution on this file as well I will make a formal 'answer' below! (My suspicion is that your second file has a different audio codec and this is easily fixed...) – andrew.46 Jun 16 '18 at 11:57
  • In 2nd case you're trying to use opus audio in .mp4. By default that's not allowed though at least here can be done by adding -strict -2 option to ffmpeg command. Simple ex. here - ffmpeg -i /home/doug/Videos/whatever.mkv -c: copy -strict -2 /home/doug/Videos/whatever.mp4 – doug Jun 16 '18 at 12:04

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.