ffprobe select audio and video streams

Amin Fazlali picture Amin Fazlali · Dec 13, 2016 · Viewed 15.1k times · Source

I use this code for extracting video information by ffprobe :

ffprobe -show_streams -of json -v quiet -i input.mp4

The information of all streams appears in the output while I need only the information of v:0 and a:0 streams.

I know that there is -select_streams option for stream selection but it accepts only one argument like: -select_streams v:0.

Can I use -select_streams by two arguments v:0 and a:0 or using it twice?

Answer

thvs86 picture thvs86 · Nov 30, 2017

I know that I'm late to the party, but in case anybody else searches for something similar (from here):

ffprobe -show_streams -select_streams a INPUT

where a stands for audio and could of course be replaced by:

  • v for video;
  • a:1 for the audio packets belonging to audio stream with index 1;
  • v:99 for the video packets belonging to video stream with index 99 and so on.

Note that if you want to view 2 different streams (like audio and video) you need to run ffprobe twice.

For more goodies, although very generally written, you can also check: https://trac.ffmpeg.org/wiki/FFprobeTips