Home > Software engineering >  CMD equivalent of linux wc -l command within a call to FFPROBE? [closed]
CMD equivalent of linux wc -l command within a call to FFPROBE? [closed]

Time:10-07

This answer would solve a lot of my problems but relies on wc -l to tally the number of audio channels from the output of ffprobe.

How do I use ffmpeg to merge all audio streams (in a video file) into one audio channel?

I'm using a Windows batch file, so I need another way of accomplishing the following in CMD:

-filter_complex "[0:v]scale=w=1920:h=1080:force_original_aspect_ratio=1,pad=1920:1080:(ow-iw)/2:(oh-ih)/2[video];[0:a]amerge=inputs=$(ffprobe -loglevel error -select_streams a -show_entries stream=codec_type -of csv=p=0 input.mov | wc -l),atempo=24000/24024[audio]"

Any help? My programming experience is minimal. This question seems like it's asking the same thing, but I can't seem to adapt its suggestions into the ffprobe call with the end result being it just returning a number.

What is the windows equivalent of Linux command wc -l?

CodePudding user response:

This is untested as I don't have your programs installed. But essentially what you need to do is capture the output of ffprobe with a FOR /F command. You will pipe the output of FFPROBE to the FIND command to get a non empty line count.

FOR /F "delims=" %%G in ('ffprobe -loglevel error -select_streams a -show_entries stream^=codec_type -of csv^=p^=0 input.mov ^| find /v /c ""') do set "count=%%G"

You can then use the variable %count% with your FFMPEG command.

  • Related