I can use the following to retrieve the audio and video codec and the video frame height:
ffprobe -v quiet -show_entries stream=index,codec_name,height -of csv input.mp4
But the output is on two lines and includes text that I don't need like so:
stream,0,h264,720
stream,1,mp3
The only output I want is to be in the form of:
mp3,h264,720
I've tried using -show_entries twice in the same command line, but it ignores the first call every time. I've also tried using
ffprobe -v quiet -select_streams v -show_entries stream=codec_name,height, -select_streams a -show_entries stream=codec_name
but that doesn't do anything.
How can I get the simplified output as specified above?
After our conversation in the comments, I think something like this is what you're looking for. It's a Batch + JScript hybrid script. I'm using JScript to parse and objectify the JSON output by
ffprobe
. Salt to taste, and removeecho
from line 31 when you're ready for the script to act.if there are blank lines before
ffprobe
output, you should add theskip=n
keyword tofor
loop.