Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • How can I generate a video file directly from an FFmpeg filter with no actual input file ?

    12 mai, par blahdiblah

    FFmpeg has a number of video generating filters, listed in the documentation as "video sources":

    • cellauto
    • color
    • mptestsrc
    • fei0r_src
    • life
    • nullsrc, rgbtestsrc, testsrc

    Those are great for using with other filters like overlay, but is there any way that I can generate a movie consisting of just one of those video sources without any input video?

    Something like:

    ffmpeg -vf color=red" red_movie.mp4
    

    Except that that errors out with At least one input file must be specified.

  • Ffmpeg rtmp to hls conversion but how to solve network issue ?

    11 mai, par Baka-Maru Lama

    I'm trying to convert hls stream from rtmp source and its' working fine but the problem is when rtmp server is down or network issue the ffmpeg hls conversion process gets stuck and never comes to work again even if rtmp server is back online.

    I've tried

    -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_delay_max 5 
    

    command - it says option is not recognized options by the way I'm using ffmpeg [v4.2.1].

    I'm using following ffmpeg commands

    ffmpeg -i rtmp://localhost/living/test  ^
    -max_muxing_queue_size 9999  ^
    -async 1 -vf yadif -g 29.97 -r 23 ^
    -b:v:0 3150k  -c:v libx264  -filter:v:0 "scale=426:-1" -rc:v vbr_hq -pix_fmt yuv420p -profile:v main -level 4.1 -strict_gop 1 -rc-lookahead 32 -no-scenecut 1 -forced-idr 1  -b:a:0 128k -map 0:v -map 0:a:0 ^
    -b:v:1 4200k  -c:v libx264 -filter:v:1 "scale=640:-1" -rc:v vbr_hq -pix_fmt yuv420p -profile:v main -level 4.1 -strict_gop 1 -rc-lookahead 32 -no-scenecut 1 -forced-idr 1   -b:a:1 192k  -map 0:v -map 0:a:0 ^
    -b:v:2 5250k  -c:v libx264 -filter:v:2 "scale=1280:-1" -rc:v vbr_hq -pix_fmt yuv420p -profile:v main -level 4.1 -strict_gop 1 -rc-lookahead 32 -no-scenecut 1 -forced-idr 1  -b:a:2 256k -map 0:v -map 0:a:0 ^
     -c:a aac -ar 48000    ^
    -f hls ^
    -var_stream_map "v:0,a:0  v:1,a:1 v:2,a:2" ^
    -master_pl_name  index.m3u8 ^
    -t 30000 -hls_time 10 ^
     -hls_init_time 4 -hls_list_size 0 ^
    -master_pl_publish_rate 10 ^
    -hls_flags delete_segments+discont_start+split_by_time "../live/test/vs%%v/manifest.m3u8" 
    pause
    
  • Stream Recorder Using FFmpeg Fails on AWS Lambda

    10 mai, par user30495567

    I am trying to stream audio from URLs and save them to a file in S3 using AWS Lambda with FFmpeg. Here is an example FFmpeg command I'm using:

    ffmpeg -hide_banner -loglevel error -t 10 -i http://playerservices.streamtheworld.com/api/livestream-redirect/KTOOFMAAC_SC -ar 16000 -b:a 64k -ac 2 output.mp3
    
    • The FFmpeg command is getting called in a python script using subprocess.Popen()
    • The command works as expected on local, but does not work in an AWS Lambda python environment using a custom FFMPEG layer configured with these instructions.
    • When run on Lambda, I get the following error: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/output.mp3'

    Note: I've also tried a version where I use python requests to stream chunks and pipe them into ffmpeg. This works for some stream URLs, but for others, such as the streamtheworld URL above, it only saves ~5 seconds of audio from the stream or results in a Broken Pipe error.

  • Unexpected error : No such file or directory : 'ffprobe', while using pydub in Digital Ocean

    10 mai, par Cjmaret

    I have an app that processes audio files and converts them to 'wav' format. This works locally on my Mac, however in DigitalOcean, when recording audio, i get the below error, followed by a 500:

    warn("Couldn't find ffprobe or avprobe - defaulting to ffprobe, but may not work", RuntimeWarning) Unexpected error: [Errno 2] No such file or directory: 'ffprobe'

    I've tried including binary files in my code for ffmpeg and ffprobe but got the same error. ffmpeg and ffprobe binaries are in /bin in the root of my project:

    from pydub import AudioSegment
    
    if platform.system() == "Darwin":  # mac
        pass
    elif platform.system() == "Linux":  # digitalocean)
        AudioSegment.converter = os.path.join("bin", "ffmpeg-linux")
        AudioSegment.ffprobe = os.path.join("bin", "ffprobe-linux")
    else:
        raise EnvironmentError(
            "Unsupported platform. Only macOS and Linux are supported.")
    
  • FFMPEG send RTP audio at 8k bytes/sec [closed]

    10 mai, par Muzza

    I'm trying to use FFMPEG to mimick a device that transmits G711U audio over UDP/RTP at 8k bytes per second. The device im mimicking sends rtp packets every 20ms with 160byte payload.

    I've had limited success using the following command

    ffmpeg -f dshow -i audio="Microphone (Realtek(R) Audio)" -ac 1 -ar 8000 -ab 8 -acodec pcm_mulaw -f rtp rtp://127.0.0.1:12345?pkt_size=160
    

    This sends G711U encoded audio, in 160byte chunks, but streams at 64kB/s, not the 8kB/s that my device is expected, so the device errors out?

    Any idea's would be massively appreciated!

    Thank you

    Log from FFMPEG

    >ffmpeg -f dshow -i audio="Microphone (Realtek(R) Audio)" -ac 1 -ar 8000 -ab 8 -acodec pcm_mulaw -f rtp rtp://127.0.0.1:12345?pkt_size=160
    ffmpeg version 2025-04-23-git-25b0a8e295-essentials_build-www.gyan.dev Copyright (c) 2000-2025 the FFmpeg developers
      built with gcc 14.2.0 (Rev3, Built by MSYS2 project)
      configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
      libavutil      60.  2.100 / 60.  2.100
      libavcodec     62.  0.101 / 62.  0.101
      libavformat    62.  0.100 / 62.  0.100
      libavdevice    62.  0.100 / 62.  0.100
      libavfilter    11.  0.100 / 11.  0.100
      libswscale      9.  0.100 /  9.  0.100
      libswresample   6.  0.100 /  6.  0.100
      libpostproc    59.  1.100 / 59.  1.100
    [aist#0:0/pcm_s16le @ 00000198256b73c0] Guessed Channel Layout: stereo
    Input #0, dshow, from 'audio=Microphone (Realtek(R) Audio)':
      Duration: N/A, start: 135470.702000, bitrate: 1411 kb/s
      Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s, Start-Time 135470.702s
    Stream mapping:
      Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_mulaw (native))
    Press [q] to stop, [?] for help
    [pcm_mulaw @ 00000198256cf240] Bitrate 8 is extremely low, maybe you mean 8k
    Output #0, rtp, to 'rtp://127.0.0.1:12345?pkt_size=160':
      Metadata:
        encoder         : Lavf62.0.100
      Stream #0:0: Audio: pcm_mulaw, 8000 Hz, mono, s16 (8 bit), 64 kb/s
        Metadata:
          encoder         : Lavc62.0.101 pcm_mulaw
    SDP:
    v=0
    o=- 0 0 IN IP4 127.0.0.1
    s=No Name
    c=IN IP4 127.0.0.1
    t=0 0
    a=tool:libavformat 62.0.100
    m=audio 12345 RTP/AVP 0
    b=AS:64
    
    [out#0/rtp @ 00000198256cdd00] video:0KiB audio:973KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 8.467470%
    size=    1055KiB time=00:02:04.51 bitrate=  69.4kbits/s speed=   1x
    Exiting normally, received signal 2.
    

    Wireshark: Wireshark Log

    Shows packets being sent every ~0.20ms