0
1
I found this thread: Handbrake settings to convert MKV to MP4 while retaining the original quality
And I can "convert" .MKV to .MP4 with the following code:
for %%a in ("*.mkv") do D:\Programme\Converter\ffmpeg\bin\ffmpeg.exe -i "%%a" -c:v copy -c:a copy "%%~na .mp4"
pause
The only problem is, that there are 2 audio lanes. The german, and the english. With the code above, it only copies the german (1st) language. But not the 2nd audio language. How can I do that?
At the moment I just convert from .MKV to .MP4 with german lang only. But I want to be able to switch the language with my VLC player from german to english.
Thanks for your help!
EDIT: I found that thread here: http://ffmpeg.gusari.org/viewtopic.php?f=25&t=611
And I tested with that informations. I changed my code above, to this code:
for %%a in ("*.mkv") do D:\Programme\Converter\ffmpeg\bin\ffmpeg.exe -i "%%a" -map 0:0 -map 0:1 -map 0:2 -c:v copy -c:a:0 copy -c:a:1 copy "%%~na.mp4"
pause
Did I do something wrong here? How could I add the german / english subtitles to that? IF I would add a subtitle map thing there, and my .MKV have no subtitles at all, would this be a problem? I just want to create a .bat file which converts a .MKV with 2 soundtracks and 2 subtitles. So that I can "remux" (or convert dunno) all my .MKV files to .MP4 without losing any informations.
At the moment, my .MKV have no subtitles, so it's not important. But it's better to prepare for the future, right?
So please tell me if I did it right, and perhaps how to add the subtitles too. It's the first time I ever used FFmpeg. Just downloaded it, never heared about it. Never really used the CMD for that.
You should show an actual, unscripted example command and the complete console output. The problem is that Matroska supports many more video, audio, subtitle, and data formats than MP4. If you want to stream copy (re-mux) from MKV to MP4, then you have to make sure that the output can support the various formats, and/or re-encode ones that are not compatible. Also, MP4 support for subtitles sucks. – llogan – 2015-04-19T00:06:15.423
I could copy paste the whole CMD if it helps. Well I really don't need to get the subtitles. I just want to change the .MKV to .MP4 with ALL the audio lanes (soundtracks). With that code it worked. I have german and english voice. But do I have to adjust that manually each time? So when a file have 3 audio lanes, do I need to adjust it each time :-\ :-( ?? Here is the full log: http://pastie.org/private/9lqyvhyotnh1o4gp6rg5g
– Benjamin Schäfer – 2015-04-19T00:16:34.637I just need to know, if that code is correct. I mean it works 100% well. I get the same file size, the same quality (compared it, should be the same) and I got both audio lanes. German and English. So normally I could start converting my 400 files... My Sony EX725 can't play .MKV but my new Sony 905A can. So I just try to convert all the .MKV to .MP4 for the old Sony TV. – Benjamin Schäfer – 2015-04-19T00:24:28.623
[mp4 @ 00000000002fb3a0] Codec for stream 0 does not use global headers but cont ainer format requires global headers [mp4 @ 00000000002fb3a0] Codec for stream 1 does not use global headers but cont ainer format requires global headers [mp4 @ 00000000002fb3a0] Codec for stream 2 does not use global headers but cont ainer format requires global headers [mp4 @ 00000000002fb3a0] track 1: codec frame size is not set [mp4 @ 00000000002fb3a0] track 2: codec frame size is not set
That's an error I get. But the file works. Can watch it, can change the audio, same quality... hmm – Benjamin Schäfer – 2015-04-19T02:05:42.093A one run script won't work here, because you don't know the number and order or streams. What you need is to sort movies in 1vid1aud1sub and 1vid2aud2sub or other variations, and only then you can use -map and a corresponding -c: copy. For subtitles you have -c:s. Those error's might be related to how MKV stores codec specs in its own container while MP4 differs. If it's working, don't try to fix it. – JasonXA – 2015-04-19T22:04:37.030