[FFmpeg-devel] [RFC] ffprobe -sep option

Stefano Sabatini stefano.sabatini-lala at poste.it
Wed Aug 17 01:42:15 CEST 2011


Hi, with the attached patch:

$ ffprobe -i ~/samples/seekbug01min.ts -show_packets -sep " "
[...]
[PACKET] codec_type=video stream_index=0 pts=126000 pts_time=1.400000 dts=126000 dts_time=1.400000 duration=3750 duration_time=0.041667 size=824.000000 pos=564 flags=K [/PACKET]
[PACKET] codec_type=video stream_index=0 pts=129750 pts_time=1.441667 dts=129750 dts_time=1.441667 duration=3750 duration_time=0.041667 size=16.000000 pos=1504 flags=_ [/PACKET]
[PACKET] codec_type=video stream_index=0 pts=133500 pts_time=1.483333 dts=133500 dts_time=1.483333 duration=3750 duration_time=0.041667 size=16.000000 pos=1692 flags=_ [/PACKET]
[PACKET] codec_type=video stream_index=0 pts=137250 pts_time=1.525000 dts=137250 dts_time=1.525000 duration=3750 duration_time=0.041667 size=16.000000 pos=1880 flags=_ [/PACKET]
...

which is sometimes easier to parse of the corresponding
one-line-per-field output.

I wonder if there is a better way to achieve this. One of the problems
with this approach is that the separator is used for separating the
[PACKET] and [/PACKET] header/trailer from fields, so for example with
-sep "," we get:

[PACKET],codec_type=video,stream_index=0,pts=126000,pts_time=1.400000,dts=126000,dts_time=1.400000,duration=3750,duration_time=0.041667,size=824.000000,pos=564,flags=K,[/PACKET]
[PACKET],codec_type=video,stream_index=0,pts=129750,pts_time=1.441667,dts=129750,dts_time=1.441667,duration=3750,duration_time=0.041667,size=16.000000,pos=1504,flags=_,[/PACKET]
[PACKET],codec_type=video,stream_index=0,pts=133500,pts_time=1.483333,dts=133500,dts_time=1.483333,duration=3750,duration_time=0.041667,size=16.000000,pos=1692,flags=_,[/PACKET]
[PACKET],codec_type=video,stream_index=0,pts=137250,pts_time=1.525000,dts=137250,dts_time=1.525000,duration=3750,duration_time=0.041667,size=16.000000,pos=1880,flags=_,[/PACKET]
...

which is not very nice (so should I add a separate option for that?).

Possible option: -psep (payload separator), with psep defaulted to
sep if not explicitely specified, so with -sep "," -psep " " we would obtain:
[PACKET] codec_type=video,stream_index=0,pts=126000,pts_time=1.400000,dts=126000,dts_time=1.400000,duration=3750,duration_time=0.041667,size=824.000000,pos=564,flags=K [/PACKET]

Tabular output (with no KEY=) can be obtained by adding another option
(-skip_fields) or the equivalent.

Comments are welcome.
-- 
FFmpeg = Fabulous and Fierce Mind-dumbing Practical Enlightened Goblin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-ffprobe-add-sep-option-experimental-not-yet-for-comm.patch
Type: text/x-diff
Size: 4805 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110817/61b0a2c6/attachment.bin>


More information about the ffmpeg-devel mailing list