Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to output fragmented mp4 with ffmpeg ?

    4 mars, par S B

    ffmpeg -i infile.avi out.mp4 outputs non-fragmented MP4.

    How do I obtain fragmented mp4?

    Update A fragmented mp4 file is internally divided into several back-to-back chunks or MPEG-4 movie fragments. Each chunk has its own moof atom - so there are several moof atoms interleaved in the file instead of a single moov at the end as in the case of an unfragmented mp4. This makes it easier to stream over slow networks where buffering is involved

    There are several tools like mp4box that convert a normal mp4 to a fragmented one. Unfortunately we cannot use something like this

    ffmpeg  | mp4box
    

    since ffmpeg does not produce seekable output while producing mp4 containers.

  • PowerShell script to Embed Album art in MP3 files - issues with accelerated audio files in ffmpeg

    4 mars, par moshe baruchi

    I am trying to embed album art into an MP3 file using a PowerShell script along with the TagLib library. The MP3 file has been speed-boosted using FFmpeg. When I run the script on regular audio files, it works fine, but with the accelerated audio files, the album art is only visible when I open the file in MP3Tag or in VLC. It's not showing up in Windows audio players and definitely not in File Explorer.

    PowerShell code

    param (
        [string]$audio,
        [string]$picture
    )
    Add-Type -Path "TagLib-Sharp.dll"
    $audioFilePath = $audio
    $albumArtPath = $picture
    $audioFile = [TagLib.File]::Create($audioFilePath)
    $tag = $audioFile.Tag
    $newPictures = New-Object System.Collections.Generic.List[TagLib.Picture]
    $newPictures.Add((New-Object TagLib.Picture($albumArtPath)))
    $tag.Pictures = $newPictures.ToArray()
    $audioFile.Save()
    

    Commands in cmd

    ffmpeg -i song.mp3 -i cover.jpg -map 0:a -map 1 -c:a copy -c:v mjpeg -metadata:s:vtitle="Album Cover" -metadata:s:v comment="Cover (front)" output_with_cover.mp3
    del song.mp3
    rename output_with_cover.mp3 song.mp3
    powershell -ExecutionPolicy Bypass -File "albumart.ps1" -audio "song.mp3" -picture "picture.jpg"
    
  • understanding HEVC NAL SEI termination and byte alignment parsing with ffmpeg

    3 mars, par rodeomacon

    The NAL SEI timecode message I am currently writing to file is 00 00 01 4E 01 88 06 XX XX XX XX XX 10 80 (The termination portion being 10 80, payloadSize set to 0x06 and the XX bytes being an encoding of the frames/seconds/minutes/hours).

    My goal is to read the timecode with ffmpeg -i video.h265 -c:v copy -bsf:v trace_headers -f null - and ffprobe -show_frames video.mov with no errors.

    The 3 left most 0 bits of the final 0x10 byte are the conclusion of the time_offset_length (Equal to 0) data. Following this, I am intending to have a rbsp_stop_one_bit followed by four rbsp_alignment_zero_bits to result in byte alignment.

    With this termination configuration (No trailing 0x80 byte and the payloadSize set to 0x05 like 00 00 01 4E 01 88 05 XX XX XX XX XX 10), ffmpeg reports Invalid value at time_offset_length[i]: bitstream ended.

    With the addition of the trailing 0x80 byte and changing the payloadSize to 0x06 to match, ffmpeg does not throw a warning but instead indicates there are extra, unused bits:

    [trace_headers @ 0000015aff793a80] Prefix Supplemental Enhancement Information
    [trace_headers @ 0000015aff793a80] 0           forbidden_zero_bit                                          0 = 0
    [trace_headers @ 0000015aff793a80] 1           nal_unit_type                                          100111 = 39
    [trace_headers @ 0000015aff793a80] 7           nuh_layer_id                                           000000 = 0
    [trace_headers @ 0000015aff793a80] 13          nuh_temporal_id_plus1                                     001 = 1
    [trace_headers @ 0000015aff793a80] 16          last_payload_type_byte                               10001000 = 136
    [trace_headers @ 0000015aff793a80] 24          last_payload_size_byte                               00000110 = 6
    [trace_headers @ 0000015aff793a80] Time Code
    [trace_headers @ 0000015aff793a80] 32          num_clock_ts                                               01 = 1
    [trace_headers @ 0000015aff793a80] 34          clock_timestamp_flag[0]                                     1 = 1
    [trace_headers @ 0000015aff793a80] 35          units_field_based_flag[0]                                   0 = 0
    [trace_headers @ 0000015aff793a80] 36          counting_type[0]                                        00000 = 0
    [trace_headers @ 0000015aff793a80] 41          full_timestamp_flag[0]                                      1 = 1
    [trace_headers @ 0000015aff793a80] 42          discontinuity_flag[0]                                       0 = 0
    [trace_headers @ 0000015aff793a80] 43          cnt_dropped_flag[0]                                         0 = 0
    [trace_headers @ 0000015aff793a80] 44          n_frames[0]                                         000110101 = 53
    [trace_headers @ 0000015aff793a80] 53          seconds_value[0]                                       010010 = 18
    [trace_headers @ 0000015aff793a80] 59          minutes_value[0]                                       010100 = 20
    [trace_headers @ 0000015aff793a80] 65          hours_value[0]                                          01010 = 10
    [trace_headers @ 0000015aff793a80] 70          time_offset_length[0]                                   00000 = 0
    [trace_headers @ 0000015aff793a80] 75          bit_equal_to_one                                            1 = 1
    [trace_headers @ 0000015aff793a80] 76          bit_equal_to_zero                                           0 = 0
    [trace_headers @ 0000015aff793a80] 77          bit_equal_to_zero                                           0 = 0
    [trace_headers @ 0000015aff793a80] 78          bit_equal_to_zero                                           0 = 0
    [trace_headers @ 0000015aff793a80] 79          bit_equal_to_zero                                           0 = 0
    [trace_headers @ 0000015aff793a80] 80          rbsp_stop_one_bit                                           1 = 1
    [trace_headers @ 0000015aff793a80] 81          rbsp_alignment_zero_bit                                     0 = 0
    [trace_headers @ 0000015aff793a80] 82          rbsp_alignment_zero_bit                                     0 = 0
    [trace_headers @ 0000015aff793a80] 83          rbsp_alignment_zero_bit                                     0 = 0
    [trace_headers @ 0000015aff793a80] 84          rbsp_alignment_zero_bit                                     0 = 0
    [trace_headers @ 0000015aff793a80] 85          rbsp_alignment_zero_bit                                     0 = 0
    [trace_headers @ 0000015aff793a80] 86          rbsp_alignment_zero_bit                                     0 = 0
    [trace_headers @ 0000015aff793a80] 87          rbsp_alignment_zero_bit                                     0 = 0
    

    Without the bit_equal_to_one, ffmpeg gives a generic error Failed to read unit 0 (type 39) after reading the time_offset_length correctly.

    What is the meaning of bit_equal_to_one and bit_equal_to_zero in this context and is this the intended SEI termination method? Why are those bits not parsed as the alignment bits?

  • Rounded corners in subtitle (Advanced Substation Alpha [.ass])

    3 mars, par Leander Mihm

    Is it possible to have rounded corners with the BorderStyle 4 in .ass (Advanced Substation Alpha)? I only found out that the BorderStyle 4 exists, because I was looking at this stackoverflow. Is there any good and complete documentation of the Advanced Substation Alpha format?

    I'm currently using the following configuration:

    BorderStyle=4 Outline=10

    Preview of the current state

  • FFmpeg matlab error : At least one output file must be specified ? [closed]

    3 mars, par as moh

    I'm trying to get I frames from a video using Matlab using this command system(sprintf('ffmpeg -i testVid.mp4 -vf "select=eq(pict_type\,I)" -vsync vfr output_%03d.png')); ,but i get this message

     ffmpeg version 7.1-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers 
      built with gcc 14.2.0 (Rev1, 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-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libopenjpeg --enable-libquirc --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-libqrencode --enable-librav1e --enable-libsvtav1 --enable-libvvenc --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --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-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-liblc3 --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint 
      libavutil      59. 39.100 / 59. 39.100 
      libavcodec     61. 19.100 / 61. 19.100 
      libavformat    61.  7.100 / 61.  7.100 
      libavdevice    61.  3.100 / 61.  3.100 
      libavfilter    10.  4.100 / 10.  4.100 
      libswscale      8.  3.100 /  8.  3.100 
      libswresample   5.  3.100 /  5.  3.100 
      libpostproc    58.  3.100 / 58.  3.100 
    Trailing option(s) found in the command: may be ignored. 
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'testVid.mp4': 
      Metadata: 
        major_brand     : isom 
        minor_version   : 512 
        compatible_brands: isomiso2avc1mp41 
        encoder         : Lavf57.83.100 
      Duration: 00:00:02.02, start: 0.000000, bitrate: 12798 kb/s 
      Stream #0:0[0x1](eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuvj420p(pc, progressive), 1280x720 [SAR 1:1 DAR 16:9], 12662 kb/s, 29.74 fps, 30 tbr, 90k tbn (default) 
          Metadata: 
            handler_name    : VideoHandler 
            vendor_id       : [0][0][0][0] 
      Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 121 kb/s (default) 
          Metadata: 
            handler_name    : SoundHandler 
            vendor_id       : [0][0][0][0] 
    At least one output file must be specified 
    

    i searched and tried many cases but i don't know where is the problem, any help please?