[FFmpeg-devel] Output to text file from filter

Mark Himsley mark at mdsh.com
Tue Jul 10 17:08:49 CEST 2012

On 10/07/12 15:18, Clément Bœsch wrote:
> On Tue, Jul 10, 2012 at 03:13:38PM +0100, Mark Himsley wrote:
>> Hey,
>> I want to put BBC R&D's shot change detector into FFmpeg as a filter.
>> but, I need to know the frame number of the frames that were picked.
>> I'm not sure that just outputting to the log output is right for
>> that, so I'm thinking I should output to a "sidecar" file.
>> I've had a look, but I haven't found examples of that in FFmpeg.
>> Does anyone have a pointer to a file I can reference to ensure I do
>> it the FFmpeg way? Or suggest why I'm a mad-man?
> Did you look at how the scene cut is made in the select filter?
> http://ffmpeg.org/libavfilter.html#select

ffmpeg -loglevel debug -i input -vf 
select='gt(scene\,0.4)',setpts='N/(25*TB)',scale=192:108 shot%04d.jpg

Yes - I agree that this command does the thumbnail detection. It's the 
getting out the frame offset. I could parse this, I suppose...

[Parsed_select_0 @ 0xb35dd80] n:837 pts:837 t:33.480000 pos:395349720 
interlace_type:T key:0 pict_type:B -> select:0.000000
n:838 pts:838 t:33.520000 pos:395626305 interlace_type:T key:0 
pict_type:B -> select:0.000000
[Parsed_select_0 @ 0xb35dd80] n:839 pts:839 t:33.560000 pos:394545174 
interlace_type:T key:0 pict_type:P -> select:1.000000
[Parsed_select_0 @ 0xb35dd80] n:840 pts:840 t:33.600000 pos:396844664 
interlace_type:T key:0 pict_type:B -> select:0.000000

but it's not easy to convince others that it's easily parseable.

Even if I just extended the select filter (instead of putting a new 
filter into FFmpeg) to output the 'n' to a file so I could easily map, 
for instance, each line of a file with each jpeg in a folder, that would 
make my life *much* easier.

Thanks for your suggestions though :-)


More information about the ffmpeg-devel mailing list