Hi, but sorry I'ma c*a*t*
I try to understand if is there a unique commandline to extract alwais channel 1 and channel 2 from a source file (or left and right) even if it is mono or stereo, 1 or multiple audiochannel, or surround 5.1 and eventually other various audio formats, provided of at least 1 audio.
My target is to get alwais a standard stereo L+R audio PCM 48Khz .wav file
So if, e.g., source is a MXF xdcamHD422 video source (xdcamhd422 have, if I don't mistake, 8 MONO audio inside) I need to use:
If the source is a MXF IMX (IMX is alwais SD and have, if I don't mistake, 2 stereo L+R inside) I need to use:Code:ffmpeg.exe -i SOURCE.MXF -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le OUTPUT.WAV
or (it get the same result)Code:ffmpeg.exe -i INPUT.MXF -af "pan=stereo:c0=c0:c1=c1" -c:a pcm_s16le -ar 48000 OUTPUT.WAV
If the source is a MP4 with audio stereo L+R:Code:ffmpeg.exe -i INPUT.MXF -map_channel 0.1.0 -map_channel 0.1.1 OUTPUT.WAV
I wonder if is there a way to tell to ffmpeg to extract alwais the first and second audio of a source, and generate alwais an output stereo L+R whatever it's the input source, mono or stereo or multi MONO, dual MONO, dual stereo etc..Code:ffmpeg.exe -i INPUT.MP4 -af "pan=stereo:c0=c0:c1=c1" -c:a pcm_s16le -ar 48000 OUTPUT.WAV
thanks
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 14 of 14
Thread
-
-
From the 4 or 5 post you have currently in the RECENT posts, I'm assuming you actually want a batch file (always a batch file) that tells whether a video has audio, even if it is PCM, automatically extracts it to a WAV file and always makes it stereo.
I really do not mean to be derogatory but Curiosity is killing me... What can you POSSIBLY use so many different Automatic batch files on, why always batch files, how many videos can you have that require batch files for multiple files, and do you have a batch file to sort the batch files when you need them?
To try to be helpful though and to answer your question, one way is, Again, to use MediaInfo CLI that will give the necessary information which can be imported as a variable and interrogated with if/then statements to use your multiple methods above. -
I only have and use 8/10 batch in total, even if each have more function selectable.
For example if I apply:
Code:ffmpeg.exe -i SOURCE.MXF -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le OUTPUT.WAV
Code:ffmpeg.exe -i INPUT.MP4 -af "pan=stereo:c0=c0:c1=c1" -c:a pcm_s16le -ar 48000 OUTPUT.WAV
-
-
Learn (on your own) how to use "for..." and variables (environmental or otherwise).
Scott -
So take those ffprobe reading or mediainfo reding in txt form. Then look at them what video gives you what result. What is the difference between two mono channels, stereo channel. Then take that txt file and check for those differences.
then you have some alternatives how to get information from that txt file based on analysys
to take line by line in that file to look for certain keywords, that returns the whole line:
Code:findstr /c:"keyword" "mediainfo.txt > "line.txt" if %errorlevel%==0 set /p new_variable= < "line.txt"
delete spaces from that variable:
Code:set new_variable=%new_variable: =%
or delete everything from that variable that is before colon (character between quotes":")
Code:set new_variable=%new_variable:*: =%
so you have that variable as a word or number, then you compare it:
Code:if [%new_variable%]==[something] (do something here) else ( do something here)
or if you need variable that mediainfoCLI can give you directly, just get it into variable right away, like:
Code:"MediainfoCLI.exe" --Inform=Video;%%FrameRate%% "%~1" > "temp.tmp" set /p fps=<"temp.tmp" echo Mediainfo reports: fps=%fps%
Code:@echo off SETLOCAL "MediainfoCLI.exe" --Info-Parameters > "parameters.txt" START "notepad.exe" "parameters.txt" ENDLOCAL
-
-
-
IMHO this can be done with https://ffmpeg.org/ffmpeg-filters.html#pan-1 - target is stereo not dual mono.
-
What can you POSSIBLY use so many different Automatic batch files on, why always batch files, how many videos can you have that require batch files for multiple files, and do you have a batch file to sort the batch files when you need them?
-
Difficult to explain that unless you have workflow based on those scripts. It could really click. But it could be constant upkeep and corrections, op should design them himself already with ease.
Similar Threads
-
FFmpeg - Audio question
By Jdan93 in forum AudioReplies: 6Last Post: 31st May 2016, 12:35 -
lost, need help with audio extraction
By ribsplitter in forum AudioReplies: 6Last Post: 8th Apr 2016, 08:31 -
FFMPEG QUESTION :How do I take 10bit jpeg with FFMPEG?
By Jamaika in forum Video ConversionReplies: 10Last Post: 6th Jul 2015, 14:41 -
Use PGC Demux for Audio extraction
By loninappleton in forum AudioReplies: 68Last Post: 17th May 2015, 17:07 -
Best quality Audio extraction from a DVD
By efiste2 in forum AudioReplies: 1Last Post: 26th Jan 2015, 16:41