[FFmpeg-user] custom video enhancements using ffmpeg

Nicolas George nicolas.george at normalesup.org
Sat Jul 28 15:29:58 CEST 2012

Le decadi 10 thermidor, an CCXX, Matt Bione a écrit :
>    I am looking to do the following :
> Add some custom enhancement (using my own code using opencv or something
> similar) to a video.
> I am looking at ffmpeg to produce raw frames which I can tweak and then
> give back to the ffmpeg to transcode it back. Is there a way to do this
> using the ffmpeg command line tools - maybe using pipes or creating streams
> ? I can think of a really inefficient way to do this - dump every frame to
> the disk using ffmpeg (e.g. , ffmpeg -i video.mpg image%d.jpg); read those
> files and apply my modifications to those images and finally call ffmpeg to
> produce a video using those frames(e.g. ffmpeg -f image2 -i image%d.jpg
> video.mpg ). But hopefully there is a better way that someone can point me
> to ?

Note that JPEG would be a very bad choice for an intermediate format, since
it is lossy: you would be losing time and quality twice (once for the file
that ffmpeg just decoded, a second time for the file that you modified).

Apart from Robert's suggestion to write your process as filters, which may
or may not be convenient for you, you have a variety of other options.

The simplest one would be to output your video to rawvideo format, and read
it back the same, using pipes. Slightly more complex, but more robust, you
can use PAM instead of rawvideo. Note that you will have to adjust the vsync
method if your video is not exactly fixed frame rate.

Another solution would be to use the ffmpeg C API instead of the
command-line tool.

Note that if you decide to write it as filters, you can consider submitting
your work to the devel mailing list.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20120728/4fb858ab/attachment.asc>

More information about the ffmpeg-user mailing list