VideoHelp Forum




+ Reply to Thread
Results 1 to 2 of 2
  1. Member
    Join Date
    Sep 2021
    Location
    Valencia
    Search Comp PM
    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
    Image Attached Thumbnails Click image for larger version

Name:	cover.png
Views:	54
Size:	169.7 KB
ID:	62501  

    Click image for larger version

Name:	end.png
Views:	28
Size:	133.5 KB
ID:	62502  

    Image Attached Files
    Quote Quote  
  2. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    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"
    Then I joined it with 3 seconds of the Cover.mp4. It then had the correct length.

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



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!