[FFmpeg-user] Overlay images to frames in video

Rainer M Krug Rainer at krugs.de
Thu Apr 8 10:27:51 EEST 2021


Thanks for your reply

Comments inline

> On 7 Apr 2021, at 21:28, pdr0 <pdr0 at shaw.ca> wrote:
> 
> Rainer M. Krug-2 wrote
>> Hi
>> 
>> First poster, o apologies for any forgotten info.
>> 
>> 
>> I have a video with the following metadata:
>> 
>> ```
>> $ ffprobe ./1.pre-processed.data/bemovi/20210208_00097.avi
>> ffprobe version 4.3.2 Copyright (c) 2007-2021 the FFmpeg developers
>>  built with Apple clang version 12.0.0 (clang-1200.0.32.29)
>>  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.2_4 --enable-shared
>> --enable-pthreads --enable-version3 --enable-avresample --cc=clang
>> --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls
>> --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d
>> --enable-libmp3lame --enable-libopus --enable-librav1e
>> --enable-librubberband --enable-libsnappy --enable-libsrt
>> --enable-libtesseract --enable-libtheora --enable-libvidstab
>> --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264
>> --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma
>> --enable-libfontconfig --enable-libfreetype --enable-frei0r
>> --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb
>> --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq
>> --enable-libzimg --disable-libjack --disable-indev=jack
>> --enable-videotoolbox
>>  libavutil      56. 51.100 / 56. 51.100
>>  libavcodec     58. 91.100 / 58. 91.100
>>  libavformat    58. 45.100 / 58. 45.100
>>  libavdevice    58. 10.100 / 58. 10.100
>>  libavfilter     7. 85.100 /  7. 85.100
>>  libavresample   4.  0.  0 /  4.  0.  0
>>  libswscale      5.  7.100 /  5.  7.100
>>  libswresample   3.  7.100 /  3.  7.100
>>  libpostproc    55.  7.100 / 55.  7.100
>> Input #0, avi, from './1.pre-processed.data/bemovi/20210208_00097.avi':
>>  Metadata:
>>    encoder         : Lavf58.45.100
>>  Duration: 00:00:12.50, start: 0.000000, bitrate: 91831 kb/s
>>    Stream #0:0: Video: png (PNG  / 0x20474E50), pal8(pc), 2048x2048,
>> 92565 kb/s, 10 fps, 10 tbr, 10 tbn, 10 tbc
>>    Metadata:
>>      title           : FileAVI write  
>> ```
>> 
>> In addition, I have 125 images (jpg, but I can as easily create them as
>> png) which contain some labelling of the individual frames. The particles
>> are moving, the images are different.
>> 
>> Now I want to overlay the images over the corresponding frames.
>> 
>> What is the easiest to do this? I could convert them to a move, then
>> overlay these two, but I have the feeling I could do this in one step?
>> 
>> Any suggestions?
>> 
>> Thanks,
>> 
>> Rainer
> 
> 



> Overlay them where? What x,y position?

1:1 overlay - i.e. covering everything.

> What is the dimension of your jpg sequence?

They are the same dimensions as the video.

> 
> jpg does not specify an alpha channel (transparency information). If you
> overlay the jpg sequence over the base video layer , and assuming they are
> the same dimensions, you will "cover up" the video layer entirely . You will
> not see the video, only the jpg sequence
> 
> When you say you can "create them as PNG", does the original source have an
> alpha channel?

The images are created in a different script. I changed it to png and they have ab alpha channel.

I am using now the following:

ffmpeg -start_number 1 -framerate 10 -i 'frame_%d.png’ -vcodec png ‘overlay.avi'

To create the move from the png files (same frame rate and codec as the second movie), and

ffmpeg -i ‘background_movie.avi' -i 'overlay.avi' -filter_complex 'overlay=0x0’ ‘final_movie.avi’

To do the actual overlay.

This is working. If I am missing something here, please let me know.


Thanks,

Rainer



> 
> 
> 
> 
> 
> 
> --
> Sent from: http://ffmpeg-users.933282.n4.nabble.com/ <http://ffmpeg-users.933282.n4.nabble.com/>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org <mailto:ffmpeg-user at ffmpeg.org>
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user <https://ffmpeg.org/mailman/listinfo/ffmpeg-user>
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org <mailto:ffmpeg-user-request at ffmpeg.org> with subject "unsubscribe".

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Zürich
Office Y34-J-74
Winterthurerstrasse 190
8075 Zürich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug at uzh.ch
		Rainer at krugs.de
Skype:     RMkrug

PGP: 0x0F52F982



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4372 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210408/125a461c/attachment.bin>


More information about the ffmpeg-user mailing list