Log in

View Full Version : Converting Certain Container Files with HVEC


KanarazuKatsu
24th January 2018, 04:07
Hello everyone, I'm just wondering if there was a way to convert certain video container formats input through x265.

Usually when I write a .avs script and pipeline a .mkv file over to x265 for encoding to .hevc, it works flawlessly - .m2ts works as well.

However, recently, I've tried with .avi (game recordings from Fraps) and it doesn't allow me to convert. I think it displayed a yv12 conversion error of some sort. I've also tried changing the .avi's container into .mkv, but the error still displays for the .avis that have been converted into .mkvs.

I hope someone knows why. Thanks you!

sneaker_ger
24th January 2018, 11:06
I'm only guessing because you didn't show your script/source/command-line but if you are trying to use an y4m pipe it won't work with RGB. Then you can use AviSynth's Convert function (http://avisynth.nl/index.php/Convert) to convert to e.g. YV12 (99.99% of all consumer video content uses YV12). Then encoding should work again.

With a search you should be able to find more info specifically about FRAPS conversions which should help you to get the colors right.

KanarazuKatsu
25th January 2018, 06:12
I'm only guessing because you didn't show your script/source/command-line but if you are trying to use an y4m pipe it won't work with RGB. Then you can use AviSynth's Convert function (http://avisynth.nl/index.php/Convert) to convert to e.g. YV12 (99.99% of all consumer video content uses YV12). Then encoding should work again.

With a search you should be able to find more info specifically about FRAPS conversions which should help you to get the colors right.

Sorry, I don't have any examples because I did this way back then and I gave up. I did however read something about this similar to what you are now explaining to me.

The line went something like this in the AvsSynth script: ConvertToYV12(matrix="Rec601", ...)

The only issue I have is, would this alter any colours compared to the source, or would this be a lossless conversion?

Thank you much for the help Sneaker!

sneaker_ger
25th January 2018, 12:23
The conversion is usually not lossless (maybe if you convert 8 bit RGB to 10 bit YUV 4:4:4 or something like that). But the losses are usually small. Biggest problem is too choose correct matrix for encoding. Usually BT.709, BT.601. I believe FRAPS even had its own matrix at some point. Sometimes will you also see VfW filters (via AviSource() ) converting YUV sources to RGB which you then have to convert back to YUV again. If possible use source filters that support the native format of your source to avoid that.

KanarazuKatsu
25th January 2018, 23:17
The conversion is usually not lossless (maybe if you convert 8 bit RGB to 10 bit YUV 4:4:4 or something like that). But the losses are usually small. Biggest problem is too choose correct matrix for encoding. Usually BT.709, BT.601. I believe FRAPS even had its own matrix at some point. Sometimes will you also see VfW filters (via AviSource() ) converting YUV sources to RGB which you then have to convert back to YUV again. If possible use source filters that support the native format of your source to avoid that.

Should I maybe use Mediainfo to check the colour space of the media container? I'm not sure, does Mediainfo display it?

sneaker_ger
25th January 2018, 23:27
It may show how the source is flagged. But author might have flagged incorrectly so it is not reliable. You basically have to know how the file was created in the first place. But MediaInfo should show if the source is natively RGB or YUV.

KanarazuKatsu
25th January 2018, 23:46
It may show how the source is flagged. But author might have flagged incorrectly so it is not reliable. You basically have to know how the file was created in the first place. But MediaInfo should show if the source is natively RGB or YUV.

I will test that out. Thank you for the tips!

Just hope this works. o_O