Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques Side by Side videos with text overlay

  • Side by Side videos with text overlay

    Posted by Charles Simonson on April 2, 2014 at 4:57 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=3840×2160 [bg]; movie=ProRes.mov, 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 test.mov

    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.

    Regards,
    CS

    Lou Logan replied 12 years, 4 months ago 2 Members · 1 Reply
  • 1 Reply
  • Lou Logan

    April 3, 2014 at 7:10 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 output.mov

    • 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.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy