I need gif overlay (equaliser line) on png background and mix it with audio to video output.
Last problem is, that gif overlay is placed twice to the output video. One on 0:0 coordinates and second on 50:262 which is specified in the 1 overlay.
Similary as attached
ffmpeg -i "audio.mp3" -ignore_loop 0 -i "anim-eq.gif" -loop 1 -i "bg.png" -filter_complex "[2]scale=w=1080:h=608,overlay=0:0[vt]; [1]scale=w=350:h=84,[vt]overlay=50:262" -c:a aac -ab 64k -ac 2 -ar 44100 -c:v libx264 -shortest "output.mp4"
Thank you for help.
You have set two overlay filters. There should be only one.
-filter_complex "[2]scale=w=1080:h=608[vt];[1]scale=w=350:h=84[eq];[vt][eq]overlay=50:262"
Related
I'm trying to overlay a webm file with transparency over a png background
What I have so far is this
ffmpeg -y -nostdin -i inputvideo.webm -itsoffset 2 -i background.png -filter_complex " [1]format=yuva420p,fade=in:st=0:d=1[i]; [0][i]overlay=x=0:y=0:shortest=1 " outputvideovideo.mp4
The issues with this is that it cuts the duration of the webm video from it's full length to 2 seconds and the image is on top of the webm
I've also tried, amongst other things, ffmpeg -y -nostdin -i background.png -i inputvideo.webm -filter_complex "overlay=(W/w)/2:(H-h)/2:shortest=1,format=yuv420p" outputvideo.mp4 but this just produces a black 0 second length video
I would appreciate any help or insight you can give me
I've solved this with
ffmpeg -c:v libvpx-vp9 -i inputvideo.webm -i template.png -filter_complex "[1:v][0:v] overlay=25:25:enable='between(t,0,20)'" -pix_fmt yuv420p -c:a copy output.mp4
I need to add an image for one second at the end of a .mp4 video file using FFMPEG. My video size is WxH and my image size is MxM, so video and image sizes are different.
I have tried different options in order to add the image at the end of the video as:
ffmpeg -i "concat: videoIn.mp4|image.jpg" -c copy videoOut.mp4
or
ffmpeg -i videoIn.mp4 -loop 1 -t 1 -i image.jpg -f lavfi -t 2 -i anullsrc -filter_complex "[0:v][0:a][1:v][2:a] concat = n=2:v=1:a=1[v][a] -c:v libx264 -c:a aac -strict -2 -map" [v] "-map" [a]" videoOut.mp4
but none gave me the result I need.
Can someone help me?
Kind regards
Use
ffmpeg -i videoIn.mp4 -loop 1 -t 1 -i image.jpg -f lavfi -t 1 -i anullsrc -filter_complex "[1:v]scale=WxH:force_original_aspect_ratio=decrease,pad=W:H:'(ow-iw)/2':'(oh-ih)/2'[i];[0:v][0:a][i][2:a] concat=n=2:v=1:a=1[v][a]" -c:v libx264 -c:a aac -map "[v]" -map "[a]" videoOut.mp4
The image is resized to fit within a WxH frame size and then padded to get the video's frame size.
You'll need ffmpeg 3.4.2 or later.
I'm looking for a way to add an audio watermark, on specific time, to a video file (with existing audio) . something like: ffmpeg -i mainAVfile.mov -i audioWM.wav -filter_complex "[0:a][1:a] amix=inputs=2:enable='between(t,9,10)' [aud]; [0:v][aud]" -c:v libx264 -vf "scale=1280:720:sws_dither=ed:flags=lanczos, setdar=16:9" -c:a libfdk_aac -ac 2 -ab 96k -ar 48000 -af "aformat=channel_layouts=stereo, aresample=async=1000" -threads 0 -y output.mp4
The above command gives me this error Timeline ('enable' option) not supported with filter 'amix'. amerge didn't work as well. I kind of get lost with filter_complex syntax, specifically with the following conditions
On the main AV file, both audio and video tracks are filtered
Watermark should be between the 9th and 10th second (I already
generated a 1 second, 10k tone file)
The watermark need to survive the proceeding audio transcode
Use
ffmpeg -i mainAVfile.mov -i audioWM.wav
-filter_complex
"[0:a]aformat=channel_layouts=stereo,aresample=async=1000[main];
[1:a]atrim=0:1,adelay=9000|9000[wm];[main][wm]amix=inputs=2"
-vf "scale=1280:720:sws_dither=ed:flags=lanczos,setdar=16:9" -c:v libx264
-c:a libfdk_aac -ac 2 -ar 48000 -b:a 96k
-threads 0 -y output.mp4
It's preferable to perform all filtering in a single filtergraph. But I've kept the video filter as-is.
Im trying to create an mp4 video from an mp3 and an image with ffmpeg. The video should be the size of 640x360 with black background and the image should be resized to fit in this dimensions and centred in the middle. The video's length must match the mp3's length.
Its basically a video creation for youtube from a song and an artwork.
For now i was able to achieve this with 3 steps:
resize image:
-i %image% -vf scale='if(gt(a,4/3),640,-1)':'if(gt(a,4/3),-1,360)' %resized_image%
create a music video with black background:
-f lavfi -i color=s=640x360 -i %audio_file% -c:v libx264 -s:v 640x360 -c:a aac -strict experimental -b:a 320k -shortest -pix_fmt yuv420p %video%
put the resized image centred in the video:
-i %video% -i %resized_image% -filter_complex "overlay=(W-w)/2:(H-h)/2" -codec:a copy %final_video%
Is it possible to achieve all this with one ffmpeg command ?
Single command would be
ffmpeg -loop 1 -i image -i audio
-vf scale='if(gt(a,4/3),640,-1)':'if(gt(a,4/3),-1,360)',pad=640:360:(ow-iw)/2:(oh-ih)/2,format=yuv420p
-c:v libx264 -c:a aac -b:a 320k -strict -2 -shortest final.mp4
I am making a setting (using anothergui) to burn in an overlay movie:
-i "<SourceFileName>"
-i "Pathto\overlay1080.mov"
-filter_complex overlay=shortest=0
-y
-vcodec prores -profile:v 3
-qscale:v 1
-acodec pcm_s16le -ar 48000 -ac 2
"<OutputPath>\forCompFolder\<OutputFileName>.mov"
The compositing is fine, but the overlay video is 999 frames long and the first input video is shorter. When I render it opts for the length of the overlay video. What am I doing wrong?
Thanks in advance.