FFMPEG attach file as metadata

前端 未结 1 1027
梦谈多话
梦谈多话 2021-02-19 06:38

I have a set of images which I want to convert to a video using ffmpeg. The following command works perfectly fine:

ffmpeg -y -i frames/%06d.png -c:v huffyuv -pi         


        
相关标签:
1条回答
  • 2021-02-19 06:59

    You need to specify your stream properly

    Example:

    ffmpeg -y -i frames/%06d.png -c:v huffyuv -pix_fmt rgb24 -attach mybinaryfile \
    -metadata:s:t mimetype=application/octet-stream testout.mkv
    

    This command will set the metadata for all attachment (t) streams (s). If you have more than one attachment, and the metadata are different, then you will have to be more specific, such as:

    -metadata:s:t:0 mimetype=text/plain \
    -metadata:s:t:1 mimetype=application/gzip
    

    This will set the metadata for the first attachment as mimetype=text/plain, and the second as mimetype=application/gzip. Remember that the stream index starts at 0, so the first steam is labeled 0.

    What was wrong with your command

    Using -metadata:s:2 (which appears to have been copied verbatim from the documentation) sets the metadata for the third stream, regardless of stream type (because no specifier is present), but your output only contained two streams.

    Attachment: None

    You may see something like this:

    Output #0, matroska, to 'output.mkv':
    ...
        Stream #0:1: Attachment: none
        Metadata:
          filename        : 2ceb-1916-56bb-3e10
          mimetype        : application/octet-stream
    

    Attachment: none does not mean that there is no attachment, but that there is no format associated with it, so it can be ignored.

    Also see

    Stream specifiers and the ffmpeg documentation on -attach, -metadata, and -map_metadata for more details.

    0 讨论(0)
提交回复
热议问题