Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
9th January 2020, 19:39 | #1 | Link |
Registered User
Join Date: Dec 2008
Location: Germany
Posts: 173
|
Optional source for muxing in ffmpeg
Want to merge 1 video and 2 audiostreams with ffmpeg.
But it can happen, that only one of both audiostreams are awailable. So I googled and found the "?" for mapping. Code:
ffmpeg.exe" -i "video.mkv" -i "audio1.wav" -i "audio2optional.wav" -map 0:0 -map 1:0 -map 2:0 -f mp4 "output.mp4" ffmpeg doesnt mux because "audio2optional.wav" is missing. I dont get the "stream/input is optional parameter" to run, using windows cli, actual build. |
10th January 2020, 03:07 | #4 | Link | |
Registered User
Join Date: Dec 2008
Location: Germany
Posts: 173
|
Sorry, this was an edited sample line for a better description, it still dont work with mkv (I used). I took out all other processing to make it as simple as possivble.
Its always a:\audio2optional.wav : No such file or directory" which of course does not exists, because it should be optional. Quote:
"%cd%\ffmpeg.exe" -i "%cd%\video\%%~nI.mkv" -i "%cd%\audio\%%~nI.mkv" -i "%cd%\subtitle\%%~nI.mkv" -c copy -map 0 -map 1 -map 2? "%pathOut%\%%~nI.mkv" It worked just fine that days. Today (actual command): --> ffmpeg.exe -i "a:\video.mkv" -i "a:\audio1.wav" -i "a:\audio2.wav" -map 0 -map 1 -map 2? "a:\testmux.mkv" --> a:\audio2.wav: No such file or directory I cant see any difference Using ffmpeg version git-2020-01-01-7b58702 |
|
10th January 2020, 04:30 | #5 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,345
|
Quote:
You can't use a question mark "?" for "-map2?" Must be a typo you had it right the first time for map -map 0:0 -map 1:0 -map 2:0 |
|
10th January 2020, 07:37 | #6 | Link |
Registered User
Join Date: Dec 2008
Location: Germany
Posts: 173
|
There is not much info about this feature around.
But for a fixed mapping I need to know if the file exists, it doesnt work with -map 2:0 if file is not existing. I found the problem around this. It works only for streams, but not if input itself is missing. I thought this was a working script I used long times ago, was a testing one I suggest now. So only for streams, not for input. Does not make that much sense, but ok ... it works as it works ... it should ignore this mapping (and missing input) if specified input is not existing. Different behavour, a little bit confusing, so my fault, sorry! https://gitlab.com/J_Darnley/ffmpeg/...a5950879122b8b |
Thread Tools | Search this Thread |
Display Modes | |
|
|