VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    Hello,

    I need to 1) create a 10s silent video from a picture, 2) edit a "soundful" video (ie. it has audio and video), and 3) join the two files.

    Using the following commands, the joined video has no audio — the input video is fine, so it's the last command that's wrong:

    Code:
    REM 1. Make video from picture:
    c:\ffmpeg -loop 1 -i pic.png -t 10 -vf scale=720:404  -c:v libx264 -pix_fmt yuv420p -c:a aac -ar 44100 -b:a 96k -ac 2 -threads 2 -f mp4 01.pic.mp4
    
    REM 2. Edit video:
    c:\ffmpeg -i input.mp4 -ss 0:13:08.280  -to 0:13:49.600 -vf scale=720:404  -c:v libx264 -pix_fmt yuv420p -c:a aac -ar 44100 -b:a 96k -ac 2 -threads 2 -f mp4 02.video.mp4
    
    REM 3. Join two video files:
    (for %%i in (*.mp4) do @echo file '%%i') > input.txt
    c:\ffmpeg -safe 0 -f concat -i input.txt -c copy joined.mp4
    
    c:\ffmpeg --version
    ffmpeg version 2023-11-05-git-44a0148fad-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
    What command should I use to join them correctly?

    Thank you.

    --
    Edit: Here's how to doctor the silent video file so it has an audio stream (it might be possible to get it right the first time):
    Code:
    c:\ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -i 01.pic.mp4 -c:v copy -c:a aac -shortest 01.pic.silent.mp4
    Last edited by yetanotherlogin; 5th Feb 2024 at 11:49.
    Quote Quote  
  2. The framerate from video 1 and 2 must be the same.
    For video 1:
    ffmpeg -framerate x -i pic.npg -t 10 (where x is the framerate from video 2).
    Quote Quote  
  3. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    I didn't set the framerate in either. Why does it matter, and is it the cause of the problem I had?
    Quote Quote  
  4. the second video has a frame rate.
    Check it with mediainfo.
    Quote Quote  
  5. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    Here's what ffprobe says about the two videos:

    Code:
    Vid1
    Duration: 00:00:10.00, start: 0.000000, bitrate: 29 kb/s
    Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 720x404, 26 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    
    Vid2  
    Duration: 00:00:41.32, start: 0.000000, bitrate: 397 kb/s
    Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 720x404 [SAR 404:405 DAR 16:9], 295 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    I'll add a "-framerate" option to avoid this error. Thanks.
    Quote Quote  



Similar Threads

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