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

Roger Pau Monné roger.pau at entel.upc.edu
Mon Apr 18 18:11:15 CEST 2011


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:

ffmpeg -i original.mpg -vf "movie=original.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

or

ffmpeg -threads 2 -i marked.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

It works perfectly (or course no difference is found). Anyway if
someone could give a hint about what I might be doing wrong I would
really appreciate it.

Thanks, Roger.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vf_watermark.c
Type: text/x-csrc
Size: 7259 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110418/c6409d9b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vf_recovermark.c
Type: text/x-csrc
Size: 9152 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110418/c6409d9b/attachment-0001.bin>


More information about the ffmpeg-devel mailing list