Reputation: 291
I am basically creating video from opengl animation uisng glreadpixels
and unix pipeline :
FILE *ffmpeg = popen("/usr/local/Cellar/ffmpeg/2.5.4/bin/ffmpeg"
" -framerate 30"
" -vcodec rawvideo"
" -f rawvideo"
" -pix_fmt rgb32"
" -s 1080x720"
" -i pipe:0 -vf vflip -vcodec h264"
" -r 60"
" /Users/xamarin/Desktop/out.mp4", "w");
Is it possible to add watermark in each frame as i am creating frames for video. I know how to add watermark in existing video but i want to add watermark as i am creating video so that in on step i get video that has watermark in it. Suggest me some parameters for ffmpeg
that can do this.
Upvotes: 0
Views: 1276
Reputation: 133693
Use the overlay filter:
ffmpeg \
-framerate 30 -f rawvideo -pixel_format rgb32 -video_size 1080x720 -i pipe:0 \
-i overlay.png \
-i audio.foo \
-filter_complex "[0:v]vflip[main];[main][1:v]overlay=format=rgb,format=yuv420p" \
-c:v libx264 -c:a aac -movflags +faststart output.mp4
The rawvideo demuxer documentation lists -pixel_format
instead of -pix_fmt
and -video_size
instead of -s
.
You probably don't need -c:v rawvideo
when you include -f rawvideo
.
I removed -r 60
because it seems unnecessary to duplicate the frames.
You may see a visual improvement when adding format=rgb
to the overlay filter for RGB inputs. The format filter is then used to make H.264 output with YUV 4:2:0 chroma subsampling which is needed for non-FFmpeg based players.
-movflags +faststart
is helpful if your viewers will watch via progressive download.
Upvotes: 2