FORUMS: list search recent posts

Side by Side videos with text overlay

COW Forums : Compression Techniques

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Charles Simonson
Side by Side videos with text overlay
on Apr 2, 2014 at 4:57:06 am

I am trying to take two UHD videos and compare them side by side to each other with a text overlay describing which is which. The first video to go on the left half of the frame is the source. The second video on the right half is a transcode of the source converted to ProRes in a previous step. I am cropping each video by half horizontally so that when the two are shown side by side, the resulting video is still in UHD resolution and appears to be a single natural image (ie, not mirrored). The final output of the combined assets must be in ProRes format again.

The following command is what I have thus far:
ffmpeg -i v210.avi -vf "crop=1920:2160:1920:0 [inScale]; color=c=black@1.0:s=3840x2160 [bg];, crop=1920:2160:0:0 [vid2]; [bg][vid2] overlay=0:0 [basis1]; [basis1][inScale] overlay=1920:0" -r 60 -c:v prores_ks -profile:v 3 -qscale:v 2 -vendor ap10 -pix_fmt yuv422p10le

This command works fine. But I would like to be able to add a simple text overlay to the final video describing which is the source and which is the transcode. Everything I have tried thus far has been met with errors in ffmpeg and I get no output file.

Any help would be greatly appreciated.


Return to posts index

Lou Logan
Re: Side by Side videos with text overlay
on Apr 3, 2014 at 7:10:58 pm

You can use the drawtext, setpts, crop, and overlay video filters:

ffmpeg -i input0 -i input1 -filter_complex \
"[0:v]drawtext=fontfile=/usr/share/fonts/TTF/Vera.ttf:fontsize=90:text='left':x=(w-text_w)/4:y=h-text_h-10,setpts=PTS-STARTPTS[l]; \
[1:v]crop=iw/2:ih:ow:0,drawtext=fontfile=/usr/share/fonts/TTF/Vera.ttf:fontsize=90:text='right':x=(w-text_w)/2:y=h-text_h-10,setpts=PTS-STARTPTS[r]; \
[l][r]overlay=W/2[out]" \
-map "[out]" -codec:v prores

  • The example above uses two obviously different video contents just to show the left and right sides.
  • setpts is used because frames are taken from each input video in timestamp order, and if their initial timestamps differ, it is a good idea to pass the two inputs through a setpts=PTS-STARTPTS filter to have them begin in the same zero timestamp.

  • This will work for any two same sized inputs. For size, all you will have to adjust is fontsize.

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 All Rights Reserved