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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th January 2020, 19:39   #1  |  Link
mbcd
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"
But I can do what I want (-map 2:0?) (-map 2?:0), ...

ffmpeg doesnt mux because "audio2optional.wav" is missing.

I dont get the "stream/input is optional parameter" to run, using windows cli, actual build.
mbcd is offline   Reply With Quote
Old 9th January 2020, 20:18   #2  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
just use -map 0
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 9th January 2020, 20:40   #3  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
If you're actually muxing (-c:a copy), not re-encoding, it won't work because WAV is not supported in MP4 container for open source muxers . MOV or MKV container should work
poisondeathray is offline   Reply With Quote
Old 10th January 2020, 03:07   #4  |  Link
mbcd
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:
just use -map 0
Yeah, funny, found this in some of my old files:
"%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
mbcd is offline   Reply With Quote
Old 10th January 2020, 04:30   #5  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by mbcd View Post

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

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
poisondeathray is offline   Reply With Quote
Old 10th January 2020, 07:37   #6  |  Link
mbcd
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
mbcd is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:44.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.