I have to merge video and audio file together. Currently I am using this command
mp4box -flat -add <video> -add <audio> <outputfile>.mp4
But the problem is, if the video is of say only 2 minutes and audio is of 5 mins, the video gets stuck at two minutes and audio plays till the last. I want to restrict the output to just 2mins.
I searched and found there is an option -shortest in ffmpeg. Is there a similar option in mp4box.


MP4Box can limit the duration of the import. You can check:

MP4Box -h import

This will show the following option:

":dur=D"             imports only the first D seconds

You can use it as follows:

mp4box -add <video> -add <audio>:dur=120 <outputfile>.mp4

Note that I removed the -flat option as you probably want to have a progressive file, with audio and video interleaving.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.