Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • FFMPEG HLS stream for Android and IOS

    30 juin, par Poda

    I'm trying to stream to mobile devices with ffmpeg and apache2.2 but I haven't been successful.

    I used this command to create the segments and the playlist:

    ffmpeg -i http://x.x.x.x:8080 -codec:v libx264 -r 25 -pix_fmt yuv420p -profile:v baseline -level 3 -b:v 500k -s 640x480 -codec:a aac -strict experimental -ac 2 -b:a 128k -movflags faststart -flags -global_header -map 0 -f hls  -hls_time 10 -hls_list_size 5 -hls_allow_cache 0 -sc_threshold 0 -hls_flags delete_segments -hls_segment_filename out%05d.ts list.m3u8
    

    The source is a http stream which is streamed by VLC media player.

    Example content of the list.m3u8 file:

    #EXTM3U
    #EXT-X-VERSION:3
    #EXT-X-ALLOW-CACHE:NO
    #EXT-X-TARGETDURATION:10
    #EXT-X-MEDIA-SEQUENCE:89
    #EXTINF:10.000000,
    out00089.ts
    #EXTINF:10.000000,
    out00090.ts
    #EXTINF:10.000000,
    out00091.ts
    #EXTINF:10.000000,
    out00092.ts
    #EXTINF:9.000000,
    out00093.ts
    #EXT-X-ENDLIST
    

    I created another playlist file - playlist.m3u8:

    #EXTM3U
    #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=512000
    http://x.x.x.x/list.m3u8
    

    If I open this (playlist.m3u8) file in VLC media player then it plays. It also works in desktop chrome and desktop firefox browsers with Video-js plugin flash fallback.

    I set the correct MIME types to the .ts and .m3u8 files in .htaccess file:

    AddType application/x-mpegURL .m3u8
    AddType video/MP2T .ts
    

    FFprobe output for playlist.m3u8:

    Input #0, hls,applehttp, from 'playlist.m3u8':
        Duration: N/A, start: 1.400000, bitrate: N/A
        Program 0
        Metadata: variant_bitrate : 512000
    Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Metadata: variant_bitrate : 512000
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata: variant_bitrate : 512000
    

    What should I do to make it work?

    UPDATE

    It works if I provide a link to list.m3u8 file (created by ffmpeg).

  • Where to download avcodec.dll ? [closed]

    29 juin, par Олег Ю.

    I see in the folder of some application FFMPEG files avcodec.dll, avformat.dll, avutil.dll, etc. They are all old version of FFMPEG. I wanted to update them, but I did not find where to download them on the FFMPEG website. Are these complete libraries available for download? Or do they exist only in development files and the authors of some application create FFMPEG .dll files themselves? In other words, avcodec.dll files from different applications are not interchangeable? Help me figure it out.

  • Manim Animation Rendering Fails on Google Cloud Run : Segment Combination Issues [closed]

    28 juin, par Ahaskar Kashyap

    Problem Summary

    I'm running a Manim animation server on Google Cloud Run that successfully creates video segments but fails during the FFmpeg combination step. The behavior is inconsistent based on the number of segments created.

    Environment

    • Platform: Google Cloud Run (8GB RAM, 4 CPU)
    • Container: Debian 12 (bookworm) with Python 3.9.23
    • FFmpeg: 5.1.6 (with h264 support enabled)
    • Manim: Latest version with -ql (480p15) quality setting
    • Timeout: 240 seconds

    Observed Behavior

    Animation Complexity Segments Created Final Video Status
    Simple (2 segments) ✅ Success ✅ Created (7,681 bytes) ❌ Reports "failed"
    Complex (8+ segments) ✅ Success ❌ Not created ❌ Actually fails

    Code Structure

    # Manim command used
    manim_cmd = [
        'manim', python_file, scene_class,
        '--media_dir', output_dir,
        '-ql',  # Low quality (480p15)
        '--disable_caching',
        '--output_file', f"{output_filename}.mp4",
        '--verbosity', 'ERROR',
        '--progress_bar', 'none',
        '--write_to_movie'
    ]
    

    Specific Issues

    Issue 1: False Negatives (Simple Animations)

    • What happens: Manim creates 2 segments successfully, FFmpeg combines them into final video
    • Problem: Final video exists and is playable, but process reports "Manim failed (code 1)"
    • Evidence: Can download the "failed" video via /videos/filename.mp4 and it plays correctly

    Issue 2: Real Failures (Complex Animations)

    • What happens: Manim creates 8+ segments successfully
    • Problem: FFmpeg combination step genuinely fails, no final video created
    • Error: Process exits with code 1, only partial segments remain

    Key Questions

    1. Why does FFmpeg combination work for 2 segments but fail for 8+ segments?
    2. Why does the same code work locally but fail on Cloud Run?
    3. Is this a Cloud Run container limitation, FFmpeg configuration issue, or Manim-specific problem?
    4. How can I debug FFmpeg combination failures in a containerized environment?

    File Structure (When Working)

    /app/manim_animations/
    └── animation_name/
        └── videos/
            └── animation_name_1234/
                └── 480p15/
                    ├── partial_movie_files/
                    │   └── SceneClass/
                    │       ├── uncached_00000.mp4
                    │       └── uncached_00001.mp4
                    └── final_animation.mp4  # This gets created for 2 segments
    

    Error Output

    🔒 ISOLATED: Manim return code: 1
    Manim failed (code 1): [stderr contains FFmpeg errors]
    

    Has anyone encountered similar issues with Manim + FFmpeg on Cloud Run or other containerized environments? Any insights into why segment count affects combination success would be greatly appreciated.

    Investigation Results

    What Works:

    • ✅ Local development (identical code works perfectly)
    • ✅ FFmpeg installation (ffmpeg -version works, h264 encoders available)
    • ✅ Segment creation (all uncached_*.mp4 files created with correct sizes)
    • ✅ Simple animations after container restart

    What Doesn't Work:

    • ❌ Segment combination for 8+ segments
    • ❌ Status detection for 2-segment animations
    • ❌ Animations after multiple renders (resource accumulation?)

    Theories Tested:

    1. Resource constraints: Upgraded to 16GB/8CPU - made things worse
    2. FFmpeg version: Upgraded 5.1.6→7.x - broke basic functionality
    3. File accumulation: Container restart helps temporarily
    4. Path detection: Isolation script may look in wrong directories
  • I can't understand how to use ffmpeg in javascript (if it's even possible)

    28 juin, par Laimonas Rupeika

    Straight to the problem, I want to use ffmpeg in my javascript project for video editing. So I found cdn: <script src="https://cdn.jsdelivr.net/npm/@salomvary/ffmpeg.js-umd@3.1.9001/ffmpeg-mp4.min.js"></script> which references to "https://github.com/Kagami/ffmpeg.js", which is ffmpeg port to javascript as I understand? I don't get any errors on import, but if I try loading ffmpeg:

    // Initialize FFmpeg after the GAPI client is loaded
      const ffmpeg = createFFmpeg({ log: true });
    
      // // Load the FFmpeg library
      await ffmpeg.load();
    

    I get error: Uncaught (in promise) ReferenceError: createFFmpeg is not defined at initializeGapiClient (index:89:18) and it also messes my whole project. So if possible, how can I use ffmpeg in pure javascript, not Node.js. Should I download ffmpeg library files and then include them in project, I'm totally lost at this.

  • ffplay video playing with slider where i can slider to any position of the video

    27 juin, par Eswar T

    is it possible to slide to a specific location of video in FFplay?

    Like how we do in VLC when we open a video a slider will be a bottom using which we can move to any part of the video is it possible in ffplay? using either commands or any GUI