VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    There doesn't seem to be a lot on the ffmpeg rotate filter since it was added later (or so I've read) and I am trying to rotate a video at an angle such as 30 degrees without showing background, which is what the documentation says c=none does. I am using the ffplay script to test before encoding. ffplay accepts rotate filter ok but the background color specified as none shows up Green (as does ffmpeg if I try it). I also noticed if I use the color in hex such as "0x000000AA, the Alpha components have no effect???

    the script i am using is:

    Code:
    ffmpeg -i <video> -vf rotate=30*PI/180:ow=hypot(iw,ih):oh=ow:c=none
    I do not really care at the moment how the video is stretched or disproportion at the moment, as I will correct that with an algorithm that addresses the aspects of a video and its Cosine functions to display a correct frame.

    The real kicker is that I swear it used to work and now does not, even though it worked at night and doesn't the next day. AS I say I'm not sure but really thought it did before. It is also baffling that the colors all show up, although with out the alpha component but none gives green.

    I would appreciate any information on this as I have read and experimented for hours without any headway.
    Quote Quote  
  2. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    Does the video format even support alpha? I mean both: The internal format after loading your source video, and the format you chose to save the video as. If you call the color "green", I suppose it is in a YUV format, not in e.g. RGBA, internally.
    Quote Quote  
  3. Maybe I misunderstand, but can't you simply leave 'c=none' away? I don't know how the 'none' color is defined or what 'none' should default to.
    Quote Quote  
  4. Member
    Join Date
    Aug 2013
    Location
    Central Germany
    Search PM
    Probably helpful: The leading text in chapter 2.7 Colors in ffmpeg's utility manual.

    It can be the name of a color as defined below (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, possibly followed by @ and a string representing the alpha component.

    The alpha component may be a string composed by "0x" followed by an hexadecimal number or a decimal number between 0.0 and 1.0, which represents the opacity value (‘0x00’ or ‘0.0’ means completely transparent, ‘0xff’ or ‘1.0’ completely opaque). If the alpha component is not specified then ‘0xff’ is assumed.
    The color "none" may mean complete transparency. But it is only meaningful for clips in RGBA color space (not sure if ffmpeg also supports YUVA variants). But after loading e.g. an MP4 with AVC video, you will probably work in a YUV color space without alpha support. So you may need to convert an input clip to RGBA after loading it, before you apply the rotate filter, to make the background around the rotated clip transparent. It won't get transparent if the color space does not support an alpha component.
    Quote Quote  
  5. Thanks for shedding light on this.
    Quote Quote  
  6. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Thanks to everyone for their help. The mpr video is indeed yuv 4.2.0 format. This makes sense since, I suspected it worked previously, perhaps on an rgb video. I bbc will test and let everyone know. If th is is th he case, wish it was listed under 'FFMPEG ROTATE FILTER' documentation lol
    Quote Quote  
  7. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    NO luck so far. Changed to RGB32 but the entire video seems to show as Alpha. I have not found a way to designate the background as the transparent color and have not been able to achieve any video with a editable transparency. Working with RGB video causes the background to be black instead of green with color set to 'None'

    Guess its not possible..

    Thanks for help from everyone though.
    Quote Quote  
  8. "c=none" means not replacing the background with each rotation. It becomes obvious with a command like:

    Code:
    ffmpeg -y -i input.mkv -vf rotate='PI*t/10:ow=hypot(iw,ih):oh=ow:c=none' output.mkv
    Note that hypot(iw,ih) may return an odd value which will cause problems with chroma subsampled sources. Better to use
    floor(hypot(iw,ih)/2)*2.

    This worked for me:

    Code:
    ffmpeg -y -i input.mkv -vf format=rgba,rotate='PI*t/10:ow=floor(hypot(iw,ih)/2)*2:oh=ow:c=0xff000000' -c:v rawvideo output.avi
    Output is uncompressed RGBA with a transparent background (the last two digits of c=0xff000000). Other alpha values worked too. For example c=0xff000080 for 50 percent transparent.
    Last edited by jagabo; 20th Mar 2021 at 09:39.
    Quote Quote  



Similar Threads

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