Compositing videos, images and text using FFmpeg

Real photos and deep fakes of Jennifer Lawrence and Steve Buscemi composited as an animated GIF. Also including some text.

As an illustrator, I have created numerous fake photos and screenshots for my books and websites. They are so realistic that it is scary.

Hillary Clinton beheads Elizabeth Warren

Unless you are a terrorist, criminal, politician, celebrity or a fashion model, your photo should not be on the Internet. There are bots that trawl the Internet for photos and use them to create fake accounts. These fake accounts are used by all reputation/perception management agencies (troll farms). Their clients range from big tech companies to governments to criminal syndicates. There are software programs that amalgamate parts of several real photos/videos and create photos/videos of realistic-looking digital Frankensteins.

Deep fakes of Jennifer Lawrence and Steve Buscemi and the real photos composited by FFmpeg

I created this GIF file using real photos and deep fakes of Jennifer Lawrence and Steve Buscemi. The deep fakes were created by someone else. I had merely composited the videos, images and text as a GIF animation using FFmpeg.

ffmpeg -stream_loop 0 -i jennifer-lawrence.jpg \
       -stream_loop 0 -i steve-buscemi.jpg \
       -i Jennifer-Lawrence-Golden-Globe-Awards-backstage-interview.mp4 \
       -i Jennifer-Lawrence-Steve-Buscemi-deep-fake.mp4 \
       -stream_loop 0 -i bookcover-ffmpeg-books.png \
       -filter_complex \
         "[0:v:0]scale=w=-2:h=500, pad=w=1538:h=500, fps=24[v1];
          [1:v:0]scale=w=-2:h=500, fps=24[v4];
          [2:v:0]trim=start=\'00:02:08.60\':end=\'00:02:28.60\',
                 setpts=PTS-STARTPTS,
                 crop=x=320:y=0:w=600:h=720, 
                 scale=w=-2:h=500, 
                 fps=24[v2];
          [3:v:0]trim=start=\'00:00:54\':end=\'00:01:14\', 
                 setpts=PTS-STARTPTS, 
                 crop=x=320:y=0:w=600:h=720,
                 scale=w=-2:h=500,
                 fps=24[v3];
          [v1][v2]overlay=x=382:y=0[v5];
          [v5][v3]overlay=x=798:y=0[v6];
          [v6][v4]overlay=x=1214:y=0,
                  drawtext=x=(w-tw)/2:y=(h-th-50):fontcolor=orange:
                           shadowx=1:shadowy=1:
                           text=www.VSubhash.in:
                           fontsize=50:font=Lato:
                           box=1:boxcolor=red@0.6:boxborderw=20[v7];
          [4:v:0]scale=w=-2:h=200, fps=24[v8];
          [v7][v8]overlay=x=(W-w-20):y=(H-h-20)[v9];
          [v9]fps=7,scale=w=-2:h=150:flags=lanczos,split[p1][p2];
          [p1]palettegen=stats_mode=diff[p];
          [p2][p]paletteuse=dither=bayer:bayer_scale=4[v10]" \
       -map '[v10]' -t 00:00:20 -y deep-fake.gif \

if [ $? -eq 0 ]; then
  xdg-open deep-fake.gif &
fi

I had also created a longer video using a similar FFmpeg command.

Link: | Magic Link:

For older posts, check the archives.