I need help to convert videos to Lagarith MP4!

This forum is for questions and discussion of all the aspects of handling your footage. If you have questions about capturing/ripping footage, AviSynth, or compression/encoding/converting, look here.

Re: I need help to convert videos to Lagarith MP4!

Postby Mister Hatt » Sat Apr 10, 2010 2:20 pm

Just clarified with a few ffmpeg developers. It seems that it will only be a lossless encode to RGBA in FFV1 if your source is a 32bit RGB format, that is, RGB32 and BGR32, and any other plane order, as long as your libswscale is recent, otherwise only RGB32 will work. All other formats (including RGB24) will be converted to YV12 first for no apparent reason that anyone can tell.

[15:27:18] <Hatt> hey astrange, any idea why FFV1 kills the alpha channel in anything I throw at it and encode as RGBA?
[02:21:29] <astrange> Hatt: ffv1 doesn't have alpha encoding, only the official huffyuv does
[02:22:57] <Hatt> and where did the whole "it converts to YV12 internally" thing come from, I remember everyone talking about that a while ago
[02:25:17] <astrange> if you don't use the right rgb pixel format (rgb32) as input it converts to yv12 instead of rgb32 for no real good reason
[02:26:32] <Hatt> and then converts back to RGBA for output?
[02:28:32] <Hatt> also, for RGB pixel format, you mean just being RGB32, or does the planar order make a difference? (BGRA vs RGBA)
[02:33:56] <astrange> it uses rgb32 but ignores the content of alpha
[02:34:14] <astrange> i mean the ffmpeg pixel format named "rgb32"
[02:41:50] <Hatt> wait, so, the encoder needs RGB32 to encode without converting to YV12 first, BGR32 will still convert to YV12?
[02:43:28] <pengvado> if you give it RGB32 it'll work, and if you give it any other RGB format it'll fatal error, and if you tell ffmpeg to encode RGB32 and the input was some other format, it'll convert
[02:44:11] <pengvado> ffmpeg will convert, that is. FFV1 doesn't.
[02:44:25] <Hatt> so if I tell ffmpeg to encode RGB32 and I feed it BGR32 it will convert and not just reorder?
[02:44:44] <pengvado> converting RGB32 to BGR32 is a reorder
[02:46:56] <pengvado> there may be some cases where libswscale is stupid, but rgb<->bgr isn't one of them
Mister Hatt
 
Joined: 25 Dec 2007
Status: better than you

Re: I need help to convert videos to Lagarith MP4!

Postby Qyot27 » Sat Apr 10, 2010 3:57 pm

They didn't say anything about other formats, though, save other RGB formats. RGB24 sure, because FFV1 doesn't seem to support that by input (and I did see that firsthand in the tests; I got around it by explicitly giving HuffYUV RGB32 via AviSynth instead of RGB24, and giving the Huffy to FFV1, or giving RGB32 from AviSynth directly to FFV1), but there should be no reason YUV 4:2:2 or YUV 4:4:4 or so on shouldn't work as expected (granted the ordering stuff and what all is correct; I was having all sorts of trouble sorting through yuv422p and yuvj422p and yuyv422p, etc.). You just have to know what you're feeding the darn thing before you do it, but that should be the case anyway.

The most I got out of that is that FFmpeg simply defaults to YV12 when it doesn't know what colorspace you're giving it, or if the format you're encoding to doesn't support the colorspace you're giving it (if it doesn't actually error out, anyway).
My profile on MyAnimeList | Quasistatic Regret: yeah, yeah, I finally got a blog
User avatar
Qyot27
Surreptitious fluffy bunny
 
Joined: 30 Aug 2002
Location: St. Pete, FL
Status: Creepin' between the bullfrogs

Re: I need help to convert videos to Lagarith MP4!

Postby Mister Hatt » Sun Apr 11, 2010 2:22 am

FFV1 only supports RGBA as input. ffmpeg itself will convert other planar RGB32 formats to RGB, but anything else from YUV to RGB24 will be converted to YV12 first. I didn't paste the entire log but that was the conclusion. The problem with the conversion is that it is not lossless. best to stick to the same colourspace whenever possible, with the same coefficients.
Mister Hatt
 
Joined: 25 Dec 2007
Status: better than you

Previous

Return to Footage Help

Who is online

Users browsing this forum: No registered users and 0 guests