Newest 'ffmpeg' Questions - Stack Overflow

Articles published on the website

  • End the video when the overlay video is finished

    2 December, by Christian Safka

    I have an overlayed video which can be longer or shorter than the background video.

    Case 1: If the background video is longer, the video should end when the overlayed video is over.

    Case 2: If the background video is shorter, it should repeat the last frame of the video until the overlayed video is over.

    With the shortest=1 and eof_action commands I haven't been able to achieve this without compromising one of the above cases. For example with shortest=1 in the overlay command, case #1 works but in case #2, both videos freeze when the background video ends while the audio plays out.

    Note that only the overlayed video has audio. Thanks!

  • Couldn't find ffmpeg or avconv - Python

    2 December, by goldie

    I'm working on a captcha solver and I need to use ffmpeg, though nothing works. Windows 10 user.

    Warning when running the code for the first time:

    C:\Users\user\AppData\Roaming\Python\Python310\site-packages\pydub\ RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
      warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)

    Then, when I tried running the script anyway and it required ffprobe, I got the following error:

    C:\Users\user\AppData\Roaming\Python\Python310\site-packages\pydub\ RuntimeWarning: Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work
      warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning)
    Traceback (most recent call last):
      File "D:\Scripts\captcha\", line 164, in 
      File "D:\Scripts\captcha\", line 155, in main
      File "D:\Scripts\captcha\", line 106, in captchaSolver
        sound = pydub.AudioSegment.from_mp3(
      File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\pydub\", line 796, in from_mp3
        return cls.from_file(file, 'mp3', parameters=parameters)
      File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\pydub\", line 728, in from_file
        info = mediainfo_json(orig_file, read_ahead_limit=read_ahead_limit)
      File "C:\Users\user\AppData\Roaming\Python\Python310\site-packages\pydub\", line 274, in mediainfo_json
        res = Popen(command, stdin=stdin_parameter, stdout=PIPE, stderr=PIPE)
      File "C:\Program Files\Python310\lib\", line 966, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "C:\Program Files\Python310\lib\", line 1435, in _execute_child
        hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
    FileNotFoundError: [WinError 2] The system cannot find the file specified

    I tried downloading it normally, editing environment variables, pasting them in the same folder as the script, installing with pip, tested ffmpeg manually to see if it works and indeed it converted a mkv to mp4, however my script has no intention of running

  • how to Extract Audio from video with spring boot java in linux or windows system with ffmpeg coding part need guidance

    2 December, by Makarand Burud

    I got this command but don't know the how to configure it for project on command line?

    String[] command = {"-y", "-i", filename, "-vn", "-ar", "44100", "-ac", "2", "-b:a", "256k", "-f", "mp3" + fileStorageLocation};

  • ffmpeg - create a morph video between 2 images (png solid hex color) 0.55 seconds for a length of 10 seconds

    2 December, by iceget

    currently i create with imagick (convert -size 640x480 xc:#FF000 hex1.png and hex2.png) 2 png images and save both png files.

    now i need the following (but i have no idea how i can do that (maybe ffmpeg?)):

    create a video 640x480 for example a length of 10 seconds like this method: 0.00s (hex1) > 0.55s (hex2) > 1.10s (hex1) > 1.65s (hex2) > 2.2s (hex1).... until the 10 seconds has reached.

    the hex1 and hex2 images should always morph/fade from hex1 => hex2 => hex1, ...

    but the time is very critical. the time must be exact always have 0.55.

    maybe i can create on same way direct the HEX colors without creating first a png image for that purposes.

    can anybody helps me how i can do that best way?

    thank you so much and many greets iceget

    currently i have created only a single image with that function: ffmpeg -loop 1 -i hex1.png -c:v libx264 -t 10 -pix_fmt yuv420p video.mp4

  • Batch File: How can I make input videos to be sequentially named in same loop

    2 December, by Ionut Bejinariu

    I end up with the code in this form.

    the first ffmpeg .. its working alone but not inside the second For that's why I made a second one, also I did this because I need to increment the Videos-* to be be Videos-1.mp4, Videos-2.mp4 ... Videos-99.mp4 , all the videos are in %videodir% named like this.

    I tried also "%videodir%\Videos-%d.mp4" also "%videodir%\*.mp4" for videos to be sequentially named loop after loop, but not worked for me.

    @echo off
    setlocal enabledelayedexpansion
    set "musicdir=F:\MONTAJ VIDEO\video-simplu\MUZICA-wav-mp3"  
    set "videodir=F:\LUCRU-VIDEO\primele-15sec"  
    set "exportdir=E:\Export-yt-shorts
    for /l %%c in (1,1,2200) Do (
      ffmpeg -i "%videodir%\Videos-%%c.mp4" -i "%videodir%\Videos-%%c.mp4" -filter_complex "[0:v]scale=3413:1920,boxblur=4[bg];[1:v]scale=1080:-1[fg];[bg][fg]overlay=(W-w)/2:(H-h)/2[tmp];[tmp]crop=1080:1920:(3413-1080)/2:0[out]" -map [out] -map 0:a output01.mp4
        for %%A in ("%musicdir%\*") DO (
       ffmpeg -i output01.mp4 -i "%%A" -map 0:v -map 1:a -vcodec copy -c:a aac -b:a 320k -shortest "%exportdir%\%%~nA.mp4"
        del output01.mp4

    Can anyone help me on this? Thank you Later Edit: I want to explain the logic I thought about the two FOR

    I have two folders. -- 1 folders with mp4 videos wide ratio 16/9 Full HD

    are named like this ---> Videos-1.mp4, Videos-2.mp4 .. Videos-3.mp4 ... Videos-2200.mp4

    and 1 folder with music mp3 and wav's

    in first for its first mp4 export that I want to combine with first song from the second for then second video with second song from folder. etc

    in the end I want to have 9/16 ratio video