[FFmpeg-devel] Using avfilter to watermark a video stream

Michael Niedermayer michaelni at gmx.at
Mon Aug 29 03:34:26 CEST 2011

On Mon, Apr 18, 2011 at 06:11:15PM +0200, Roger Pau Monné wrote:
> Hello,
> I'm trying to watermark the key frames of a video stream using a DCT
> transformation, I've developed a watermark and recovermark filters, to
> add and recover the mark (which I've attached to this email). However
> I'm not able to recover the mark correctly, and I think it is because
> a problem in the marking. I mark the videos using the following
> command:
> ffmpeg -i original.mpg -vf "[in] watermark=80:1.2|1.3|1.4:111 [out]"
> -vcodec mpeg2video -sameq -acodec copy marked.mpg
> Then I recover the mark using this command:
> ffmpeg -i original.mpg -vf "movie=marked.mpg, setpts=PTS-STARTPTS
> [wm];[in] setpts=PTS-STARTPTS, [wm] recovermark=3:1.2|1.3|1.4 [out]"
> -vcodec rawvideo -an -f null /dev/null
> However frames compared from vsrc_movie are not key_frames, and I
> don't know how to sincronize them. My guess is that I'm doing
> something wrong in the insertion of the mark, because if I execute:

you can adjust the scenechnage detection threshold so that it will
never trigger then the keyframes would be in more predictable places
if that confirms that keyframe placement is your problem then
you could implement support for filters to force frame types

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- 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-devel/attachments/20110829/7740927f/attachment.asc>

More information about the ffmpeg-devel mailing list