Forum Replies Created

Page 1 of 9
  • Lou Logan

    October 9, 2019 at 7:47 pm in reply to: FFMPEG: Add black frames at start and end of video

    [Andrew Baldinger] “What is that 60 after the -t doing?”

    That’s the total output duration. So the output will be 60 seconds in that example. I had to add -t to manually declare an output duration because -shortest isn’t working. This is only needed for the example with audio. The -t value should be input duration + stop_duration.

    [Andrew Baldinger] ffmpeg -i input -filter_complex "[0:v]tpad=stop_duration=10:color=black[v]" -map "[v]" output

    Right?”

    That will work assuming you only want video and no audio.

  • If you know you aren’t upscaling (which is bad) then the culprit is probably the chroma subsampling occurring in the overlay filter. Use the “format=auto” option in the overlay filter, such as:

    overlay=10:10:format=auto

    Use the code button next time to properly format your command.

  • It is not possible to split channels or use filters without re-encoding, but in this case you can stream copy (re-mux) the video without re-encoding because you are not filtering it.

    Use the channelmap filter:

    ffmpeg -i input -af "channelmap=map=0|1:channel_layout=stereo" -c:v copy output

    or

    ffmpeg -i input -af "channelmap=map=FL|FR:channel_layout=stereo" -c:v copy output

    See “ffmpeg -layouts” for channel layout names and descriptions.

  • ffmpeg can’t do this by itself. You need to use additional features present in your shell/command line.

    The answer depends on what you are using, but you didn’t mention your OS.

    For Linux or macOS you can use a Bash for loop:

    for f in *.jpg; do ffmpeg -framerate 25 -loop 1 -i "$f" -i "${f%.*}.mp3" -c:v libx264 -vf format=yuv420p -c:a aac -movflags +faststart -shortest "${f%.*}.mp4"; done

    If you’re on Windows refer to cmd, batch file, or PowerShell help resources regarding a “for loop” or whatever the Windows equivalent is.

  • Lou Logan

    October 9, 2019 at 6:35 pm in reply to: FFMPEG: Add black frames at start and end of video

    With just video:

    ffmpeg -i input -filter_complex "tpad=stop_duration=10" output

    With video and audio:

    ffmpeg -i input -filter_complex "[0:v]tpad=stop_duration=10[v];[0:a]apad[a]" -map "[v]" -map "[a]" -shortest output

    However, this second example will not work. I believe there is an existing bug so this command will encode indefinitely (at least at the time I wrote this, but it will probably be fixed eventually).

    So you can add the -t option instead of -shortest:

    ffmpeg -i input -filter_complex "[0:v]tpad=stop_duration=10[v];[0:a]apad[a]" -map "[v]" -map "[a]" -t 60 output

    If you want to script it use ffprobe to get the input duration and -t should be input duration + stop_duration.

    Alternatively, use the color source filter and anullsrc filter to create 10 second black video and silent audio, then concatenate with the concat filter or concat demuxer. Note that all parameters must match the input for proper concatenation, so it can be tricky. If you do it right you can avoid re-encoding if you use the concat demuxer.

  • Lou Logan

    March 8, 2019 at 7:51 pm in reply to: FFMPEG: Add black frames at start and end of video

    I’m guessing you downloaded the release version 4.1.1. As I mentioned no release has tpad.

    Download the “nightly get version” instead. It will be named something like “20190308-9645147”.

  • Lou Logan

    March 7, 2019 at 8:12 pm in reply to: FFMPEG: Add black frames at start and end of video

    There is a better, easier method now using the tpad and adelay filters. This example will add 10 seconds of black video and delay the audio by 10 seconds:

    ffmpeg -i input -filter_complex "[0:v]tpad=start_duration=10:color=black[v];[0:a]adelay=10000|10000[a]" -map "[v]" -map "[a]" output

    The tpad filter is newer than any release version, and release versions don’t get new features backported, so it won’t be in any release until version 4.2. This is one reason why general users are recommended to always use a recent build from the git master branch. See the FFmpeg Download page for links to already compiled builds from the git master branch for Linux, macOS, and Windows.

  • Why do you want WebM? Also, WebM is just a container format, so I must ask if you are outputting VP8 or VP9 video.

    You should show your ffmpeg command and the complete console output/log.

  • Lou Logan

    February 11, 2016 at 8:07 pm in reply to: ffmpeg transcoding error

    Can you provide a short sample input file so we can attempt to duplicate the issue?

    Why the screenshots instead fo simply copying and pasting the text?

  • Lou Logan

    October 12, 2015 at 6:59 pm in reply to: jpeg2000 out of ffmpeg messed up chroma?

    Complete console outputs missing.

Page 1 of 9

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy