Hello:
I have one MP4 file (1.mp4), and two PNG files (cover.png, end.png)
I want to add the cover.png file before the MP4 file to merge with the MP4 file (let it become a 3 seconds video part), and append the end.png (also let it become a 3 seconds video part) file after the MP4 file to make a final MP4 file.
What I can do now is:
I can merge the cover.png file with the MP4 file to make a MP4 file (let it become a 3 seconds video part), the cover.png is at the beginning of MP4 file, but the resulting MP4 file becomes 1 second less than the original MP4 file. However, I want the resulting MP4 file is 3 seconds longer than the original. How I can do this with ffmpeg in Windows 10.
The following is my ffmpeg command:
D:\Videos>ffmpeg -y -i 1.mp4 -framerate 29.67 -loop 1 -i cover.png -filter_complex "[1:v] fade=outt=3:d=1:alpha=1 [ov]; [0:v][ov] overlay=1:1 [v]" -map "[v]" -map 0:a -c:v libx264 -c:a copy -shortest out_cover_1.mp4
I can merge the end.png file with the MP4 file to make a MP4 file (let it become a 3 seconds video part), the end.png is at the end of MP4 file. However, I want the resulting MP4 file is 3 seconds longer than the original. How I can do this with ffmpeg?
The following is my ffmpeg command:
D:\Videos>ffmpeg -y -i 1.mp4 -sseof -3 -copyts -i 1.mp4 -loop 1 -i end.png -filter_complex "[1][2]overlay=shortest=1[logo];[0][logo]overlay" out_1_end.mp4
+ Reply to Thread
Results 1 to 2 of 2
-
-
You are overlapping the cover (1 sec) and the Main video (fade 1 sec), so you lose a second. The best way I have found is to fade the video you want faded and then join them. I tried fading in 1.mp4 for 1 second in a batch file. I use chcp 1252 in case there are characters that CMD or FFmpeg do not like. Its a canned message that my program spits out that works but you really only need the last line.
Code:"chcp 1252" Set "SDL_AUDIODRIVER=directsound" "ffmpeg" -i "C:\Users\Bud\Desktop\1.mp4" -t 93.037334 -vf fade=t=in:st=0:d=1:c="Black" -vcodec libx264 -crf 20 -b:v 400K -bufsize:v 400K -r 29.97 -acodec aac -ac 2 -ar 48000 -y "C:\Users\Bud\Desktop\Resized_0_0_2_0_1_1.mp4"
If you wish to use your method(notice there is 1 second of both videos overlaying each other.) If this is what you want, change the cover.mp4 to 4 seconds to fix the 1 second overlay loss of time.
Similar Threads
-
ffmpeg - output metadata, add/remove modification then add it to the video
By kalemvar1 in forum Video ConversionReplies: 3Last Post: 30th Jul 2021, 01:29 -
seeking commandline front-end for using NVEnc
By hydra3333 in forum Video ConversionReplies: 28Last Post: 6th Mar 2019, 14:13 -
Add picture at end of video?
By Shaorin in forum Newbie / General discussionsReplies: 3Last Post: 8th Dec 2018, 19:39 -
Announcing QtlMovie, a specialized graphical front-end to FFmpeg
By lelegard in forum Latest Video NewsReplies: 58Last Post: 9th Apr 2017, 14:33 -
Converting images to video using FFMPEG on Windows
By Nabil SAFIR in forum Video ConversionReplies: 1Last Post: 24th Jan 2017, 09:13