VideoHelp Forum
+ Reply to Thread
Results 1 to 17 of 17
Thread
  1. I tried using both Solveig Video Splitter and ffmpeg to create a gif from a video with the following details,

    General
    Complete name : C:\Users\Bruce\Desktop\test.mkv
    Format : Matroska
    Format version : Version 2
    File size : 404 KiB
    Duration : 1s 320ms
    Overall bit rate : 2 506 Kbps
    Writing application : libmatroska 1.4.1
    Writing library : SolveigMM Matroska Muxer Version 1.0.1502.18

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L3.2
    Format settings, CABAC : Yes
    Format settings, ReFrames : 12 frames
    Codec ID : V_MPEG4/ISO/AVC
    Duration : 1s 320ms
    Bit rate : 2 072 Kbps
    Width : 720 pixels
    Height : 572 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 25.000 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.201
    Stream size : 334 KiB (83%)
    Language : English
    Default : No
    Forced : No
    Color range : Limited
    Color primaries : BT.601 NTSC
    Transfer characteristics : BT.601
    Matrix coefficients : BT.601

    A woman's lipstick, red in the video, turned browny orangey yellowy in the gif. What should I do? Bear in mind you'll have to give me step-by-step instructions as I understand ZERO about videos.
    Quote Quote  
  2. The problem is that the GIF can only use 256 different colors. Other shades are simulated with error diffusion, dithering, etc. If there's very little red in the video, and a lot of other colors, a palette optimized GIF may not include red shades in its palette. That will result in the type of shift you're seeing. You need to modify the palette to include the reds you need for the lips. You could do that by modifying the palette directly, or by somehow increasing the amount of red lips in the video. For example, when building the palette crop the image down so that the lips take up proportionally more of the frame(s). Or crop and enlarge the lips then overlay the enlargement over an otherwise redundant (color wise) portion of the frame. Once you have a more appropriate palette you can generate the finale GIF with that palette.

    Another thing you might try is increasing the saturation during the palette building phase. That will give you more intense colors to work with in the GIF.

    Basically, GIF isn't intended for full motion, full color, video.
    Quote Quote  
  3. Originally Posted by jagabo View Post
    The problem is that the GIF can only use 256 different colors. Other shades are simulated with error diffusion, dithering, etc. If there's very little red in the video, and a lot of other colors, a palette optimized GIF may not include red shades in its palette. That will result in the type of shift you're seeing. You need to modify the palette to include the reds you need for the lips. You could do that by modifying the palette directly, or by somehow increasing the amount of red lips in the video. For example, when building the palette crop the image down so that the lips take up proportionally more of the frame(s). Or crop and enlarge the lips then overlay the enlargement over an otherwise redundant (color wise) portion of the frame. Once you have a more appropriate palette you can generate the finale GIF with that palette.

    Another thing you might try is increasing the saturation during the palette building phase. That will give you more intense colors to work with in the GIF.

    Basically, GIF isn't intended for full motion, full color, video.
    Thanks for the advice. I really wouldn't like to interfere with the video in any way. I was just hoping there might be an easy and quick method of just correcting the colour imbalance. From now on, if colour is really important, I'll just convert to an APNG instead. Thanks again.
    Quote Quote  
  4. Originally Posted by Bruce Wayne View Post
    I really wouldn't like to interfere with the video in any way.
    Everything I told you would not effect the video itself, just the colors that are used to render the video.
    Quote Quote  
  5. Originally Posted by jagabo View Post
    Originally Posted by Bruce Wayne View Post
    I really wouldn't like to interfere with the video in any way.
    Everything I told you would not effect the video itself, just the colors that are used to render the video.
    Ah, I see. Thanks but it still sounds too complicated and time-consuming. I've noticed a colour shift of some kind in only 2 or 3 gifs. For the most part, I don't have a problem. So I'll just convert to APNG whenever it's an issue.
    Quote Quote  
  6. APNG is abetter choice than animated GIF. Unfortunately, support isn't as wide.
    Quote Quote  
  7. Originally Posted by Bruce Wayne View Post
    Ah, I see. Thanks but it still sounds too complicated and time-consuming. I've noticed a colour shift of some kind in only 2 or 3 gifs. For the most part, I don't have a problem. So I'll just convert to APNG whenever it's an issue.
    This is not color shift but wrong color quantization/reduction selection. In GIF you are no longer due color shift but you must from all colors in your picture select best 256 at max - later you must apply one of those 256 colors to picture.

    In your case better color reduction algorithm may work better - IMHO best you can do is select key frames in one large picture (creating new picture that is mosaic of your key frames) and use very good color quantization algorithm to generate palette file and later apply this palette file to your video.
    Be careful with APNG as it may be not supported by players/browsers - GIF is de facto standard for animation but APNG not.
    Quote Quote  
  8. Originally Posted by jagabo View Post
    APNG is abetter choice than animated GIF. Unfortunately, support isn't as wide.
    Yeah, it sucks. But most sane people I know have Firefox anyway. lol
    Quote Quote  
  9. Originally Posted by pandy View Post
    Originally Posted by Bruce Wayne View Post
    Ah, I see. Thanks but it still sounds too complicated and time-consuming. I've noticed a colour shift of some kind in only 2 or 3 gifs. For the most part, I don't have a problem. So I'll just convert to APNG whenever it's an issue.
    This is not color shift but wrong color quantization/reduction selection. In GIF you are no longer due color shift but you must from all colors in your picture select best 256 at max - later you must apply one of those 256 colors to picture.

    In your case better color reduction algorithm may work better - IMHO best you can do is select key frames in one large picture (creating new picture that is mosaic of your key frames) and use very good color quantization algorithm to generate palette file and later apply this palette file to your video.
    Be careful with APNG as it may be not supported by players/browsers - GIF is de facto standard for animation but APNG not.
    Thanks but I'd rather not reduce the colours any further just to compensate for a little red loss. The rest of the gif is fine as it is and, as I've said, I haven't noticed this problem with many gifs so I won't be using APNGs that often anyway.
    Quote Quote  
  10. Originally Posted by Bruce Wayne View Post
    Thanks but I'd rather not reduce the colours any further just to compensate for a little red loss. The rest of the gif is fine as it is and, as I've said, I haven't noticed this problem with many gifs so I won't be using APNGs that often anyway.
    ? Well for GIF you MUST reduce number of colors as GIF is format for 2 - 256 colors pictures - you may use better algorithm for color reduction (neuquant should be OK http://members.ozemail.com.au/~dekker/NEUQUANT.HTML http://pngnq.sourceforge.net/ )

    Instead APNG/GIF use WebM and regular video (unless you must have hard edges and reduced color palette but from your description is not a case)
    Quote Quote  
  11. Originally Posted by Bruce Wayne View Post
    Originally Posted by jagabo View Post
    APNG is abetter choice than animated GIF. Unfortunately, support isn't as wide.
    Yeah, it sucks. But most sane people I know have Firefox anyway. lol
    So use video compression format instead drawing format.
    Quote Quote  
  12. Originally Posted by pandy View Post
    Originally Posted by Bruce Wayne View Post
    Thanks but I'd rather not reduce the colours any further just to compensate for a little red loss. The rest of the gif is fine as it is and, as I've said, I haven't noticed this problem with many gifs so I won't be using APNGs that often anyway.
    ? Well for GIF you MUST reduce number of colors as GIF is format for 2 - 256 colors pictures - you may use better algorithm for color reduction (neuquant should be OK http://members.ozemail.com.au/~dekker/NEUQUANT.HTML http://pngnq.sourceforge.net/ )

    Instead APNG/GIF use WebM and regular video (unless you must have hard edges and reduced color palette but from your description is not a case)
    No, I definitely don't want those. I'd just like whichever animation format I use to look as close to the original video as possible. Thanks for the links to those algorithms but I'm afraid I don't have a clue as to how to go about using them.

    APNG uses WebMs? That's weird. I just tried making a WebM video and loading it into VirtualDub APNG Mod and it didn't work. Unsupported format message.
    Quote Quote  
  13. Originally Posted by pandy View Post
    Originally Posted by Bruce Wayne View Post
    Originally Posted by jagabo View Post
    APNG is abetter choice than animated GIF. Unfortunately, support isn't as wide.
    Yeah, it sucks. But most sane people I know have Firefox anyway. lol
    So use video compression format instead drawing format.
    How?
    Quote Quote  
  14. Video is not drawing, for video compression you need to use proper compression, gif compression is not for video but for limited color (up to 256) usually drawing.
    Are you able provide details why you must use gif (apng) not video compression?

    Using neuquant is very simple - search for picture with those lips - export it to 24 bit picture, apply neuquant, 256 color version of picture will be created, export this picture as palette, use palette to create gif.
    Quote Quote  
  15. Originally Posted by pandy View Post
    Video is not drawing, for video compression you need to use proper compression, gif compression is not for video but for limited color (up to 256) usually drawing.
    Are you able provide details why you must use gif (apng) not video compression?
    No reason. I'm perfectly fine using HTML5 instead of gif. Just wondering if there was a really easy way to fix the gif.

    Using neuquant is very simple - search for picture with those lips - export it to 24 bit picture, apply neuquant, 256 color version of picture will be created, export this picture as palette, use palette to create gif.
    Isn't that what ffmpeg does though? And when you say apply NeuQuant, OK, but, how? How do I "apply" NeuQuant. You've got to understand, I understand nothing. I have no idea what I'm doing. I need step-by-step instructions.
    Quote Quote  
  16. [QUOTE=Bruce Wayne;2441222]
    No reason. I'm perfectly fine using HTML5 instead of gif. Just wondering if there was a really easy way to fix the gif.

    No easy fix - format limitations - 256 colors are shared between all video frames.
    http://www.imagemagick.org/Usage/video/

    Simply color re-quantization algorithm ignored red lips and red was substituted by other closest color

    Originally Posted by Bruce Wayne View Post
    Isn't that what ffmpeg does though? And when you say apply NeuQuant, OK, but, how? How do I "apply" NeuQuant. You've got to understand, I understand nothing. I have no idea what I'm doing. I need step-by-step instructions.
    yes - this is performed by ffmpeg but not trough neuquant color requantization but other algorithm - gif capabilities in ffmpeg are somehow reduced and imagemagick offer substantially more tools to perform video 2 gif but still not support some of modern color requantization algorithms like neuquant or scolorq ( http://bisqwit.iki.fi/jutut/colorquant/ ) .
    Your problem with gif laid in generating optimum 256 colors for frame - sometimes manual color selection seem to be only one option.
    Color reduction is very tricky problem http://www.imagemagick.org/Usage/quantize/

    If you can use video (HTML5) then not use gif for video like source - gif may work for video without many colors (cartoon, drawings etc) .
    Also video size will be smaller and at the same usually better looking.
    http://blog.smartbear.com/devops/gif-is-dead-long-live-webm/

    https://en.wikipedia.org/wiki/Video_alternative_to_GIF
    Quote Quote  
  17. [QUOTE=pandy;2441224]
    Originally Posted by Bruce Wayne View Post
    No reason. I'm perfectly fine using HTML5 instead of gif. Just wondering if there was a really easy way to fix the gif.

    No easy fix - format limitations - 256 colors are shared between all video frames.
    http://www.imagemagick.org/Usage/video/

    Simply color re-quantization algorithm ignored red lips and red was substituted by other closest color

    Originally Posted by Bruce Wayne View Post
    Isn't that what ffmpeg does though? And when you say apply NeuQuant, OK, but, how? How do I "apply" NeuQuant. You've got to understand, I understand nothing. I have no idea what I'm doing. I need step-by-step instructions.
    yes - this is performed by ffmpeg but not trough neuquant color requantization but other algorithm - gif capabilities in ffmpeg are somehow reduced and imagemagick offer substantially more tools to perform video 2 gif but still not support some of modern color requantization algorithms like neuquant or scolorq ( http://bisqwit.iki.fi/jutut/colorquant/ ) .
    Your problem with gif laid in generating optimum 256 colors for frame - sometimes manual color selection seem to be only one option.
    Color reduction is very tricky problem http://www.imagemagick.org/Usage/quantize/

    If you can use video (HTML5) then not use gif for video like source - gif may work for video without many colors (cartoon, drawings etc) .
    Also video size will be smaller and at the same usually better looking.
    http://blog.smartbear.com/devops/gif-is-dead-long-live-webm/

    https://en.wikipedia.org/wiki/Video_alternative_to_GIF
    Thanks for all the info. I was just about to open another thread on WebMs.
    Quote Quote  



Similar Threads

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