简体   繁体   中英

display only lines from output that contains a specified word

I'm looking for a way to get only the lines that contains a specified word, in this case all lines that contains the word Stream from an output

I've tried;

streams=$(ffprobe -i  "movie.mp4"  | grep "Stream")

but that didn't get any results..

or do I need to output it to a file and then try to extract the lines I'm looking for?

@paulsm4 was spot on ... the output goes to STDERR.

streams=$(ffprobe -i  "movie.mp4"  |& grep "Stream")

Note the &

No need for grep . Just use ffprobe directly to get whatever info you need.

Output all info

ffprobe -loglevel error -show_format -show_streams input.mp4

Video info only

ffprobe -loglevel error -show_streams -select_streams v input.mp4

Audio info only

ffprobe -loglevel error -show_streams -select_streams a input.mp4

Width x height

See Getting video dimension / resolution / width x height from ffmpeg

Duration

See How to get video duration?

Format / codec

Info on frames

See Get video frames information with ffmpeg

More info and examples

See FFmpeg Wiki: ffprobe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM