Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > General > Newbies

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th November 2013, 20:14   #1  |  Link
juGGaKNot
Registered User
 
juGGaKNot's Avatar
 
Join Date: Feb 2008
Posts: 733
ImageWrite for colorspace conversion ?

Hi guys.

I use this script :

Quote:
AVIsource("orig.avi",audio=false) >> m1.avs
SelectEvery(340,0) >> m1.avs
ImageWriter("Screenshotorig", type="bmp") >> m1.avs
avsutil.exe m1.avs play

FFVideoSource("orig.mp4").assumefps(30) >> m2.avs
ConvertToRGB32() >> m2.avs
SelectEvery(340,0) >> m2.avs
ImageWriter("Screenshotencd", type="bmp") >> m2.avs
avsutil.exe m2.avs play
To compare the color of the original uncompressed video and the encoded x264 video.

Is this accurate ?

Cheers.
__________________
Quote:
Originally Posted by Dark Shikari View Post
If they can beat x264 in visual quality on ordinary test clips without postprocessing, I'll eat my hat.
juGGaKNot is offline   Reply With Quote
Old 26th November 2013, 20:32   #2  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,371
Probably not -
1. AVIsource: color model, matrix and luma range unknown. Must be verified for the particular codec in use.
2. ImageWriter: "bmp" is RGB mode, so if AviSource is YUV, an implicit conversion will take place.
3. FFVideoSource: color model, matrix and luma range unknown. Must be verified.
4. ConvertToRGB32: implicit "colormatrix=Rec.601" - which is probably wrong (images are 0-255, not 16-235)

You would have to calibrate every stage of the process, starting with an AVI (same codec) with known colors - that is, an AVI with calibrated colors that uses the same codec as the actual video you want to work with (whether H.264, Xvid, Huffyuv etc) (see here maybe)

EDIT you could verify the whole signal chain at once instead of breaking it down into steps, but you might get two or more errors that cancel each other out. This would introduce subtle problems like clipping or banding, but as long as you check for those problems you should be OK.

Last edited by raffriff42; 26th November 2013 at 22:23.
raffriff42 is offline   Reply With Quote
Old 27th November 2013, 10:50   #3  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,442
Quote:
Originally Posted by raffriff42 View Post
2. ImageWriter: "bmp" is RGB mode, so if AviSource is YUV, an implicit conversion will take place.
There is no implicit conversion. If source is YUV, ImageWriter throws an error, so AviSource must be delivering RGB here (possibly after conversion by the VfW codec selected).
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 27th November 2013, 18:26   #4  |  Link
juGGaKNot
Registered User
 
juGGaKNot's Avatar
 
Join Date: Feb 2008
Posts: 733
Quote:
Originally Posted by raffriff42 View Post
Probably not -
1. AVIsource: color model, matrix and luma range unknown. Must be verified for the particular codec in use.
2. ImageWriter: "bmp" is RGB mode, so if AviSource is YUV, an implicit conversion will take place.
3. FFVideoSource: color model, matrix and luma range unknown. Must be verified.
4. ConvertToRGB32: implicit "colormatrix=Rec.601" - which is probably wrong (images are 0-255, not 16-235)
Original avi is uncompressed 4:4:4 SD so Rec.601 should be ok no ? If i use PC.601 the image is too dark.

The outputs look almost identical ( the red is not as bright on the encode but i thought that's because of the 4:4:4 > 4:2:0 conversion )
__________________
Quote:
Originally Posted by Dark Shikari View Post
If they can beat x264 in visual quality on ordinary test clips without postprocessing, I'll eat my hat.
juGGaKNot is offline   Reply With Quote
Old 27th November 2013, 22:00   #5  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,371
>Original avi is uncompressed 4:4:4 SD so Rec.601 should be ok no ? If i use PC.601 the image is too dark.
Sounds reasonable.

>The outputs look almost identical
Check the color on several media players, and don't be shocked if the color is different.
raffriff42 is offline   Reply With Quote
Old 28th November 2013, 17:33   #6  |  Link
juGGaKNot
Registered User
 
juGGaKNot's Avatar
 
Join Date: Feb 2008
Posts: 733
Quote:
Originally Posted by raffriff42 View Post
Check the color on several media players, and don't be shocked if the color is different.
That's what i'm trying to avoid, comparing the video files with media players. I'm talking about the bmp output from the script.
__________________
Quote:
Originally Posted by Dark Shikari View Post
If they can beat x264 in visual quality on ordinary test clips without postprocessing, I'll eat my hat.
juGGaKNot is offline   Reply With Quote
Old 29th November 2013, 02:41   #7  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,371
You're trying to make the two signals as consistent as possible for comparison purposes, and that's good; but I think they can be made just as consistent using Avisynth alone. The main source of uncertainty, in any case, is AviSource & FFVideoSource - and the decoders *they* call. The script below makes the two clips look the same to the media player, which is exactly the benefit of writing bitmaps, I think.
Code:
#avisynth

## Perform an A-B comparison - flip between clip A and clip B
## NOTE examine this frame-by-frame, not in real time.

## Clip filters shown as an example - 
## use just enough filtering to allow
## the two videos to be interleaved.

A=AviSource("orig.avi")
\ .AssumeFPS(30)
\ .ConvertToRGB32(matrix="Rec601")
\ .KillAudio

B=FFVideoSource("orig.mp4")
\ .AssumeFPS(30) 
\ .ConvertToRGB32(matrix="Rec601") 
\ .KillAudio

return Interleave(
\  A.SelectEven.Subtitle("A"), 
\  B.SelectEven.Subtitle("B"))
EDIT thank you Gavino vv

Last edited by raffriff42; 29th November 2013 at 15:11.
raffriff42 is offline   Reply With Quote
Old 29th November 2013, 10:20   #8  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,442
Quote:
Originally Posted by raffriff42 View Post
## use just enough filtering to allow
## the two videos to be interleaved.
Neither AssumeFPS() or KillAudio() are required for that.
All that is necessary is that the the two videos have the same dimensions and colorspace.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 29th November 2013, 17:54   #9  |  Link
juGGaKNot
Registered User
 
juGGaKNot's Avatar
 
Join Date: Feb 2008
Posts: 733
Quote:
Originally Posted by raffriff42 View Post
code#avisynth
Will try this.

Quote:
Originally Posted by Gavino View Post
All that is necessary is that the the two videos have the same dimensions and colorspace.
And when they are not the result will differ, right ? That's why i want to use it to check the colorspace on my entire chain

uncompressed > vegas > uncompressed > x264 > youtube > x264 from youtube.
__________________
Quote:
Originally Posted by Dark Shikari View Post
If they can beat x264 in visual quality on ordinary test clips without postprocessing, I'll eat my hat.
juGGaKNot is offline   Reply With Quote
Old 29th November 2013, 18:18   #10  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,371
Quote:
Originally Posted by juGGaKNot View Post
uncompressed > vegas > uncompressed > x264 > youtube > x264 from youtube.
OK given that workflow, I'd suggest an additional test:
Vegas internal colorbars > uncompressed > x264 > youtube > x264 from youtube

...Assuming "x264 from youtube" means a screen capture, not a downloaded file, since this is what the audience will be seeing. Alternatively you can set your media player to emulate the look of YouTube's player, which IIRC assumes 16-235, BT.701.

Last edited by raffriff42; 29th November 2013 at 18:28.
raffriff42 is offline   Reply With Quote
Old 29th November 2013, 19:33   #11  |  Link
juGGaKNot
Registered User
 
juGGaKNot's Avatar
 
Join Date: Feb 2008
Posts: 733
Quote:
Originally Posted by raffriff42 View Post
OK given that workflow, I'd suggest an additional test:
Vegas internal colorbars > uncompressed > x264 > youtube > x264 from youtube
Ok will do. As long as the test is ok i will see what comes out.

Quote:
...Assuming "x264 from youtube" means a screen capture, not a downloaded file, since this is what the audience will be seeing. Alternatively you can set your media player to emulate the look of YouTube's player, which IIRC assumes 16-235, BT.701.
Won't a screen capture be affected by my gfx card settings ?
I meant a downloaded file to see if their reencoded video still looks like the original.
__________________
Quote:
Originally Posted by Dark Shikari View Post
If they can beat x264 in visual quality on ordinary test clips without postprocessing, I'll eat my hat.
juGGaKNot is offline   Reply With Quote
Old 29th November 2013, 20:14   #12  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,371
Quote:
Originally Posted by juGGaKNot View Post
Won't a screen capture be affected by my gfx card settings ?
That's a tough one. Yes, I guess, with some settings. I've convinced myself that on *my* system, a screen cap is accurate (displaying test videos and still images with known colors, and testing the screen colors with a probe such as ColorPic, then opening the capture in an image editor and probing the colors again)
raffriff42 is offline   Reply With Quote
Old 30th November 2013, 18:37   #13  |  Link
juGGaKNot
Registered User
 
juGGaKNot's Avatar
 
Join Date: Feb 2008
Posts: 733
Quote:
Originally Posted by raffriff42 View Post
That's a tough one.
Just went to a friends house and he has an old 1600x900 monitor + a hd7750 and the same video is is very dark on his screen ( i think fullrange is on )

So i have to test it for myself, i'll add some screens when done here.

Thanks to everyone.
__________________
Quote:
Originally Posted by Dark Shikari View Post
If they can beat x264 in visual quality on ordinary test clips without postprocessing, I'll eat my hat.
juGGaKNot is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:33.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.