FFmpeg – Overlay one video onto another video?

If you just want a ffmpeg command, try ffmpeg -i input.mov -i overlay.mov \ -filter_complex “[1:v]setpts=PTS-10/TB[a]; \ [0:v][a]overlay=enable=gte(t\,5):shortest=1[out]” \ -map [out] -map 0:a \ -c:v libx264 -crf 18 -pix_fmt yuv420p \ -c:a copy \ output.mov This starts the overlay at 5 seconds with the overlaid video start point being 00:15. setpts=PTS-10/TB is setpts=PTS+(overlay_delay-video_trim_in)/TB overlay=enable=gte(t\,5) is … Read more

Concat a video with itself, but in reverse, using ffmpeg

Technically, you can do it using ffmpeg -i input.mp4 -filter_complex “[0:v]reverse,fifo[r];[0:v][0:a][r] [0:a]concat=n=2:v=1:a=1 [v] [a]” -map “[v]” -map “[a]” output.mp4 But the reverse filter will use a lot of memory for large videos. I’ve added a fifo filter to avoid frame drops. But test and see. (I haven’t reversed the audio) If your clip has no … Read more

How can HTML5 video’s byte-range requests (pseudo-streaming) work?

I assume your video is in an Mp4 container. The mp4 file format contains a hierarchical structure of ‘boxes’. One of these boxes is the Time-To-Sample (stts) box. This box contains the time of every frame (in a compact fashion). From here you can find the ‘chunk’ that contains the frame using the Sample-to-Chunk (stsc) … Read more

HTML 5 video custom controls

In the HTML5 spec, there is a controls attribute for <video>. Also check out this article: Video on the Web – Dive into HTML5. It explains: By default, the element will not expose any sort of player controls. You can create your own controls with plain old HTML, CSS, and JavaScript. The element has methods … Read more

FFmpeg: How to convert vertical video with black sides, to video 16:9, with blurred background sides

I solved! ffmpeg -i input.mp4 -lavfi ‘[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16’ -vb 800K output.webm Input: https://www.youtube.com/watch?v=17uHCHfgs60 Output: http://www.youtube.com/watch?v=CgZsDLfzrTs

Creating AVI files in OpenCV

Why not testing all codecs, in order to play save: CV_FOURCC(‘P’,’I’,’M’,’1′) = MPEG-1 codec CV_FOURCC(‘M’,’J’,’P’,’G’) = motion-jpeg codec (does not work well) CV_FOURCC(‘M’, ‘P’, ‘4’, ‘2’) = MPEG-4.2 codec CV_FOURCC(‘D’, ‘I’, ‘V’, ‘3’) = MPEG-4.3 codec CV_FOURCC(‘D’, ‘I’, ‘V’, ‘X’) = MPEG-4 codec CV_FOURCC(‘U’, ‘2’, ‘6’, ‘3’) = H263 codec CV_FOURCC(‘I’, ‘2’, ‘6’, ‘3’) = … Read more