I'm trying to extract certain info from ffmpeg output.
Sample ffmpeg output:
configuration: --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264
libavutil version: 49.0.0
libavcodec version: 51.9.0
libavformat version: 50.4.0
built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mov':
Duration: 00:01:32.0, start: 0.000000, bitrate: 63489 kb/s
Stream #0.0(eng): Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
Stream #0.1(eng), 29.97 fps(r): Video: Apple ProRes 422, 1280x720
Must supply at least one output file
I want to get back a string with just Duration, frame rate, codec, and size, e.g.:
[00:01:32_29.97_Apple ProRes 422_1280x720]
I tried starting with this (from another hint):
ffmpeg -i file.mov 2>&1 | sed -n 's/Duration: \(.*\), start/\1/gp'
to get the Duration, but that just 'removed' the Duration and , start, i.e.:
00:01:32.0: 0.000000, bitrate: 63489 kb/s
PS: I'd also like to remove the Apple from Apple ProRes 422 :-)
Thanks!
Update: I was able to extract the codec with
sed -n "s/.*\Video: \(.*\),.*/\1/p"
but I don't know how to (a) get the size and framerate, and (b) combine the searches on one line...