I have downloaded a movie in Mkv format and I want to convert it into mp4 format, now mkv file has multiple audio and subtitle streams along with the video stream so when I try to convert it to mp4 using FFmpeg I am getting only one video and audio stream in mp4 files. Is there any way I can get all streams from mkv file to mp4 using FFmpeg?
If the subtitle stream contains a format other than the unique MPEG-4 Timed Textformat, you may not utilize an MP4 container. However, you can change it:
ffmpeg -i input.mkv -vcodec copy -acodec copy -scodec mov_text output.mp4
By doing this, you can include all streams, including those with modified subtitles.
The video and audio streams are not recorded; they are just copied by this command. Timed text is used to translate the subtitles.
You can also, burn the subtitles into a video using FFmpeg.
When you try to convert mkv file mp4 using FFmpeg with a simple command like
ffmpeg -i input.mkv -c copy output.mp4
It will only copy the video stream and one audio stream is found in the mkv file if your
mkv file contains multiple audio streams and subtitle streams then you have to copy those streams with
-map options like this: -map 0:a copies all audio streams from your first input file and
-map 0:s copies all subtitle streams from your input file.
If you want to map only a specific audio/subtitle stream in your
output mp4 then you have to use the index of that stream in the input file with the -map option like this:
-map 0:3 (you have mapped stream at index 3 input mkv). You can find out about these stream indices with the following command.
Thank you, please do let me know if you face any problem in the above process.
Thanks for your response. I tried this and it worked, however, I received this message.
-dcodec options specified for stream 1, only the last option ‘-c:a aac’ will be used.
Not sure if I should be concerned about it? I used the following code.
for /R %f IN (*.mkv) DO ffmpeg -v warning -hide_banner -stats -i “%f” -map 0:v -map 0:a -c copy -c:a aac "%~nf.mp4"Any solution to overcome this error?
Since all of your input streams are already MP4 compatible just use:
ffmpeg -i input.mkv -map 0 -c copy output.mp4
This will resolve your issue, if you still face any problem then do let me know, happy to assist you.