Monday, July 23, 2012

ffmpeg scene detection and how to use it

I needed scene detection and since I am using ffmpeg to convert my home movies it would be handy to also use ffmpeg for that.

I found out that it was recently added here:

The related commit I found here:;h=72868144e5862168a4f829557b7a41f686b8b12d

which also included some instructions on how to use it:

2644 Complete example to create a mosaic of the first scenes:
2646 @example
2647 ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
2648 @end example

Luckily I built directly from source yesterday and should been able to use this new functionality right away. Unfortunately I get this error:

Assertion ref->buf->refcount > 0 failed at libavfilter/buffer.c:147

I don't know how to fix that yet.
UPDATE: Apparently, this is because the amount of tiles are to much for the mosaic which apparently has a standard size based on the tile-size, also my recordings were very "dirty" (some of them DVB-recordings). First converting them to MKV fixed the latter issue.

Please note that this is very new functionality and I do not recommend to use this in production.

Related links:

No comments:

Post a Comment