What I’m trying to do is to watermark the videos “on the fly” in my site, so I don’t need to store the watermarked ones.
I use PHP in the server side.
I’m trying to do it calling ffmpeg:
1.-The user requests the video
2.-The server executes a PHP script to deliver it:
The PHP script calls ffmpeg using “passthru”. The command is something like:
ffmpeg -i original.flv -sameq -vf "movie='thewatermark.png' [logo],[in][logo] overlay=10:main_h/2-60 [out]" -f flv - 2>/tmp/ffmpeg.log
Two problems arise:
1.-The “Duration” metadata is not properly set by ffmpeg when outputting to stdout. This implies flash video player (flowplayer in my case) can’t handle seek features.
2.-When executing the ffmpeg command from PHP I get an error: When I execute the ffmpeg command manually in the server, it generates the final video correctly, but when executed from within the PHP script, after some seconds generating the video, the following error arises:
av_interleaved_write_frame(): Operation not permitted
If I decrease the quality (removing the -sameq parameter) of the resulting video, it is executed without this error. It seems there’s some kind of limitation executing it from PHP, but I can’t figure it out (I’ve increased the memory and time limits with no results).
Any idea?
thanks!