Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Encode video with alpha channel

  1. #1
    Join Date
    Jun 2010
    Beans
    49

    Encode video with alpha channel

    I have a sequence of images with transparency which I want to convert into a video with alpha channel. The following attempts did not work:

    Code:
    ffmpeg -f image2 -pattern_type glob -i '*.png' -vcodec png chromakeyed.mov
    Code:
    ffmpeg -f image2 -pattern_type glob -i '*.png' -vcodec vp6a chromakeyed.flv
    Code:
    ffmpeg -f image2 -pattern_type glob -i '*.png' -vcodec huffyuv chromakeyed.avi
    Code:
    ffmpeg -f image2 -pattern_type glob -i '*.png' -vcodec ffvhuv chromakeyed.avi
    Code:
    ffmpeg -f image2 -pattern_type glob -i '*.png' -vcodec qtrle chromakeyed.mov
    All returned:
    Code:
    [image2 @ 0x1cb68c0] Could not find codec parameters for stream 0 (Video: png): unspecified size
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    *.png: could not find codec parameters
    The files are named "Fire0000.png" counting up.

    I furthermore tried

    Code:
    ffmpeg -f image2 -i Fire%04d.png -vcodec png chromakeyed.mov
    and

    Code:
    ffmpeg -f image2 -i Fire%04d.png -s 720x480 -vcodec png chromakeyed.mov
    Both return

    Code:
    [image2 @ 0x1cb68c0] Could not find codec parameters for stream 0 (Video: png): unspecified size
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Fire%04d.png: could not find codec parameters
    The message "*.png: could not find codec parameters" only comes with ffmpeg 2.0.1. "glob -i '*.png'" worked with version N-53430-g2c2e69b from May 25 2013 05:26:47 but the results were crappy.

  2. #2
    Join Date
    Feb 2009
    Location
    Dallas
    Beans
    1,306
    Distro
    Ubuntu Gnome 14.04 Trusty Tahr

    Re: Encode video with alpha channel

    For starters I'd go with Libav. What are you trying to do with the videos? Some codecs are better than others depending on who/what needs to be able to decode the videos.

  3. #3
    Join Date
    Jun 2010
    Beans
    49

    Re: Encode video with alpha channel

    Quote Originally Posted by lukeiamyourfather View Post
    For starters I'd go with Libav.
    Is this just a guess or do you know it will work?

    Quote Originally Posted by lukeiamyourfather View Post
    What are you trying to do with the videos?
    It's a muzzle blast (gun fire) effect which I need to join to a video file for re-using it in one of my films. I know that this works in principle as I have another effect which has such an alpha channel.

    Quote Originally Posted by lukeiamyourfather View Post
    Some codecs are better than others depending on who/what needs to be able to decode the videos.
    As you can see I already tried different codecs. From the error message I guess that the error is in the file selection.

  4. #4
    Join Date
    Sep 2006
    Beans
    3,480

    Re: Encode video with alpha channel

    Please provide a sample input PNG file.

  5. #5
    Join Date
    Jun 2010
    Beans
    49

    Re: Encode video with alpha channel

    I'll attach some. These are the first frames from the CC BY licensed video "Machine_Gun_Muzzle_Flash_Final.mov" by footagecrate.com . I extracted them via avidemux and added the alpha channel in gimp.
    Attached Images Attached Images

  6. #6
    Join Date
    Sep 2006
    Beans
    3,480

    Re: Encode video with alpha channel

    Code:
    ffmpeg -i Fire%04d.png -codec:v qtrle output.mov
    or
    Code:
    ffmpeg -pattern_type glob -i '*.png' -codec:v qtrle output.mov
    Should both work with recent ffmpeg (not the old, buggy, fake "ffmpeg" from the repo). You can follow a step-by-step guide to compile ffmpeg or simply download and use a Linux build of ffmpeg.

    I recommend stream copying the PNG images into a MOV container:
    Code:
    ffmpeg -i Fire%04d.png -codec:v copy output.mov
    If your other software does not accept that then try qtrle as shown in the first two commands.

    Also see How to create an uncompressed AVI from a series of 1000's of PNG images using FFmpeg.
    Last edited by FakeOutdoorsman; August 21st, 2013 at 12:56 AM.

  7. #7
    Join Date
    Jun 2010
    Beans
    49

    Re: Encode video with alpha channel

    Quote Originally Posted by FakeOutdoorsman View Post
    Code:
    ffmpeg -i Fire%04d.png -codec:v qtrle output.mov
    Result with ffmpeg 2.0.1 is:
    Code:
    [image2 @ 0x2be5840] Could not find codec parameters for stream 0 (Video: png): unspecified size
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Fire%04d.png: could not find codec parameters
    The result with ffmpeg N-53430-g2c2e69b looks crappy (see attachment).

    Similar results for
    Code:
    ffmpeg -pattern_type glob -i '*.png' -codec:v qtrle output.mov
    Quote Originally Posted by FakeOutdoorsman View Post
    not the old, buggy, fake "ffmpeg" from the repo
    I downloaded the source and compiled it myself

    Quote Originally Posted by FakeOutdoorsman View Post
    Thanks for the advice but in principle I know how to do it (and did multiple times before). It's "just" this particular one which does not work.
    Attached Files Attached Files
    Last edited by xxlray; August 22nd, 2013 at 07:36 AM. Reason: format fix

  8. #8
    Join Date
    Sep 2006
    Beans
    3,480

    Re: Encode video with alpha channel

    Quote Originally Posted by xxlray View Post
    Result with ffmpeg 2.0.1 is:
    Code:
    [image2 @ 0x2be5840] Could not find codec parameters for stream 0 (Video: png): unspecified size
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    Fire%04d.png: could not find codec parameters
    Are the attached images from your earlier post all of the input images? I would need each of your input images to attempt to duplicate the issue.

    Quote Originally Posted by xxlray View Post
    The result with ffmpeg N-53430-g2c2e69b looks crappy (see attachment).
    According to which player(s)? It does not look great in ffplay, but it looks better in an After Effects composition, so it may still be usable in your other software.

  9. #9
    Join Date
    Jun 2010
    Beans
    49

    Re: Encode video with alpha channel

    Quote Originally Posted by FakeOutdoorsman View Post
    Are the attached images from your earlier post all of the input images? I would need each of your input images to attempt to duplicate the issue.
    I will attach all (and have to devide them into multiple posts to overcome forum limitations).


    Quote Originally Posted by FakeOutdoorsman View Post
    According to which player(s)? It does not look great in ffplay
    It looks bad in VLC and is not even playable in avidemux (screen stays green). I use openshot for cutting my videos and the effect's background is white instead of transparent (covering the rest of the scene). Here is a comparison how I see it:

    comparisson.jpg
    Attached Files Attached Files

  10. #10
    Join Date
    Jun 2010
    Beans
    49

    Re: Encode video with alpha channel

    Here is the rest and thanks for your efford.
    Attached Files Attached Files
    Last edited by xxlray; August 22nd, 2013 at 08:08 AM. Reason: thanks

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •