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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VirtualDub, VDubMod & AviDemux

Reply
 
Thread Tools Search this Thread Display Modes
Old 29th December 2014, 18:18   #1  |  Link
Killgore
Registered User
 
Join Date: Nov 2003
Posts: 14
MJPEG videos appear darker in VD

Hello,

I have a little problem with MJPEG videos from my old Canon camera.

In VirtualDub they look noticeably darker than in most other players (I've attached two small samples).

E.g. in Windows Media Player and VLC they look brighter but in MPC-HC - exactly the same as in VirtualDub.
After compressing with Xvid or x264 (fast recompress) they look equally dark in all players.

I tried switching to internal decoder but result is the same.

Then I tried other programs: MediaCoder gave the same results, but XMedia Recode with Xvid codec gave video looking as in VLC. Since XMedia doesn't give me the same amount of control as VD I'd like to get similar results in VD.

MJPEG videos are (according to VLC) in Planar 4:2:2 YUV full scale.

I don't know what is the cause of this anomaly. In players I can change "darkness level" by changing output e.g. in VLC, when I change to OpenGL output video becomes darker (like in VD) and in MPC-HC after changing to madVR video is brighter.
And again: this applies only to my MJPEG avis. When I play any other files I don't see these differences.

On the other hand I've tried selecting different display modes on Display page in VD preferences and it hasn't changed output even one bit.

In MediaCoder changing source to FFmpeg from default MEncoder resulted in brighter ouput, but video became much more pixelated.

It seems to be somehow related to color scale conversion, but i don't know how to fix it.

All programs in their latest versions.
Attached Images
  
__________________
Regards,
Chris

Any remarks considering bad grammar or syntax are highly appreciated. :)

Last edited by Killgore; 29th December 2014 at 18:41.
Killgore is offline   Reply With Quote
Old 29th December 2014, 18:52   #2  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,508
If my memory serves me correctly, this is a bug in some MJPEG codecs. VirtualDub requests RGB from its codecs, unlike most other players, and the codec uses the wrong matrix (TV range instead of PC range, or the other way around, I can never remember which!)

If you don't need to use any VD filters, try setting VD to "Fast recompress" under the Video menu before encoding.

There's also an option to "Prefer internal video decoders over installed third-party codecs (MJPEG and DV)" in Preferences which might work.

Failing that, you could use an Avisynth script to load the AVI (if it is an AVI) and use converttorgb24 with whichever is the correct matrix.

David
__________________
My AviSynth filters / I'm the Doctor
davidhorman is offline   Reply With Quote
Old 30th December 2014, 11:34   #3  |  Link
Killgore
Registered User
 
Join Date: Nov 2003
Posts: 14
@davidhorman
As mentioned in my first post I've already tried first two suggestions.
As to AVS, I'll try that and report back results.
__________________
Regards,
Chris

Any remarks considering bad grammar or syntax are highly appreciated. :)
Killgore is offline   Reply With Quote
Old 30th December 2014, 21:58   #4  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 3,250
Quote:
Originally Posted by Killgore View Post
MJPEG videos are (according to VLC) in Planar 4:2:2 YUV full scale.
Most video is YUV limited scale so a lot of decoders do not expect full range video and AVI has no in-spec way to identify full-range video.

Using Avisynth 2.6 a simple:
ConvertToRGB24(matrix="PC.601") should work or ConvertToRGB24(matrix="PC.709") if it is HD.
Asmodian is offline   Reply With Quote
Old 30th December 2014, 23:47   #5  |  Link
davidhorman
I'm the Doctor
 
Join Date: Jan 2004
Posts: 1,508
On further reflection, I think my solution was to do
Code:
AviSource("source.avi",pixel_type="rgb32")
That may have been before I understood about matrixes, and doing that presumably leaves the matrix up to the codec, which may not get it right.
__________________
My AviSynth filters / I'm the Doctor
davidhorman is offline   Reply With Quote
Old 8th January 2015, 22:08   #6  |  Link
Killgore
Registered User
 
Join Date: Nov 2003
Posts: 14
Hello,

finally, I've managed to resolve my problem.
First, thank you all for suggestions as they helped me in picking the right direction.

Code:
AviSource("file.avi")
ConvertToRGB24(matrix="PC.601")
Above script worked (gave brighter image).
So, I've tried:

Code:
DirectShowSource("file.avi")
It also worked (as you see without "convert" command).

So, I could use those scripts, but it would be unwieldy, as I would have to make such script for each converted file.

And I thought: what is the difference between avisource (or VD or MPC-HC) and directshowsource (or VLC or MediaPlayer)?
Different codecs with different settings.

Through a lot of trial and error I've found that if I force MPC-HC to use ffdshow instead of default LAV, and set Output -> RGB Conversion -> Input levels to Auto (from default Standard which is in limited color range) video in MPC-HC looks good.

So, using Codec Tweak Tool -> VFW Codecs -> ffdshow VFW interface -> Decoder -> Codecs I chose libavcodec for MJPEG and chage Input levels as above.

Now VD uses ffdshow for decoding and full range in MJPEG when necessary.
__________________
Regards,
Chris

Any remarks considering bad grammar or syntax are highly appreciated. :)
Killgore 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 14:36.


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