VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Hey,

    I’m using ffmpeg to convert a GIF to a WEBM file, like so:

    Code:
    ffmpeg -i test.gif -r 25 -an -c:v libvpx -crf 23 test.webm
    This works pretty well. The produced file is playable in both Firefox and Chrome, and has a decent enough quality for its very small size (compared to the source GIF).

    However, when trying to play this file in Media Player Classic Home Cinema (from CCCP—don’t judge me), the video is not displayed correctly. The first frame seems to be fine, but all subsequent ones are mostly white with just a few artifacts appearing where movement is in the video. You can see what it looks like for me in this GIF screencapture (that’s a bit ironic). Also, the file is not rendered with a preview in Windows Explorer (unlike every other video).

    Now I don’t really know why this happens, especially as other’s WEBM files—for example those from YouTube—play just fine in MPC-HC. I’ve checked the output file using MediaInfo, and this is what I get:

    Code:
    General
    Unique ID                                : 109982964302111834666886362827577618438 (0x52BDF2CC73BAA4B055C86773E647F006)
    Complete name                            : C:\path\to\test.webm
    Format                                   : WebM
    Format version                           : Version 4 / Version 2
    File size                                : 143 KiB
    Duration                                 : 5s 160ms
    Overall bit rate                         : 228 Kbps
    Writing application                      : Lavf55.22.100
    Writing library                          : Lavf55.22.100
    
    Video
    ID                                       : 1
    Format                                   : VP8
    Codec ID                                 : V_VP8
    Duration                                 : 5s 160ms
    Bit rate                                 : 212 Kbps
    Width                                    : 480 pixels
    Height                                   : 360 pixels
    Display aspect ratio                     : 4:3
    Frame rate mode                          : Constant
    Frame rate                               : 25.000 fps
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.049
    Stream size                              : 133 KiB (93%)
    Default                                  : Yes
    Forced                                   : No
    I’ve compared this with the WEBMs, YouTube uses, and the only difference (apart from the obvious things that make out the video) is that those are missing the “Unique ID”, have just the format version “Version 2” (instead of 4 and 2) and list the “overall bit rate mode” explicitely as “variable”.

    So I could imagine that the format version ffmpeg creates, 4/2, is somewhat too new or special. Is there a way to generate just a “version 2” file with ffmpeg? Or is the reason for this problem something completely different?

    Thanks a lot in advance!
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Have you tried other players? Like vlc, mplayer. Just to see if it's something wrong/different with mpchc.
    Quote Quote  
  3. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Another possibility: remux with MKVtoolnix
    (tick the "Create WebM compliant file" checkbox in the Global tab)
    Last edited by El Heggunte; 16th Dec 2013 at 11:30. Reason: .....
    Quote Quote  
  4. Originally Posted by El Heggunte View Post
    Another possibility: remux with MKVtoolnix
    (tick the "Create WebM compliant file" checkbox in the Global tab)
    Yet another possibility is to run it through:

    http://www.pazera-software.com/products/webm-converter/
    Quote Quote  
  5. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    To encode the video files the program uses the FFmpeg encoder (ffmpeg.org).

    (Pazera)
    Quote Quote  
  6. VLC works, but so do Firefox and Chrome; the odd thing is that all other webm files that I have do work with MPC-HC… Remuxing it using MKVtoolnix unfortunately did not change anything.

    I tried encoding it to an AVI first and then to WEBM and that interestingly works. So I guess that the extraction of the GIF frames is actually somewhat broken. Any ideas?

    Also, out of interest, does it work for you?
    Quote Quote  
  7. I suspect the command line results in an 8 bit color pallette (because that's what GIF files use). Try:

    ffmpeg.exe -i test.gif -r 25 -an -c:v libvpx -pix_fmt yuv420p -crf 23 test.webm
    Quote Quote  
  8. Interesting, that really works! I was under the impression that the conversion from RGB to YUV420p would involve some serious color-loss or washed-out colors. At least that’s what I am used to from encoding with x264. And that’s actually also why I chose to try webm for this, as it seemed to support RGB just fine.

    But now, even converted as YUV420p, it matches the original colors really well. Thanks a lot, I can live with this result!
    Quote Quote  
  9. GIF files aren't RGB. They're 8 bit palettized files. Each pixel is represented by an single byte (8 bits, 256 possible values). That byte is used as an index to a table of RGB values the determine the color of the pixel. Ie, it's a paint by number scheme: color 0 is black, color 1 is red, color 2 is green... color 255 is white. I suspect ffmpeg used a similar palettized color scheme to make the VP8 video. Or maybe it used some other direct color format but subsampling that MPCHC's VP8 decoder doesn't understand.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!