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 14th February 2016, 17:02   #1  |  Link
asaleo
Registered User
 
Join Date: Mar 2013
Posts: 27
FFmpeg with VirtualDub gives low contrast, why

Can anyone here explain following problem:
mp4 videos opened with ffmpeg plugin in virtualdub shows low contrast. When I exported frames from virtualdub and opened them in Photoshop Elements I could see that the histogram on frames from a "ffmpeg video" didnīt show any pixels in the beginning and in the end of the diagram. After adjusting end trianges to the actual start and end I got a better picture.
What is wrong with my ffmpeg installation? I have tried all alternatives in option before opening av mp4 file.
"Tateau-videos" do not show this type of histogram.

Added later: When I engaged a filter in Virtualdub called AutoLevels v1.2
I got correct colours and a full histogram.
Why is that needed?
Regards
asaleo is offline   Reply With Quote
Old 14th February 2016, 18:52   #2  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 776
This is a common issue: color range hell.
For example maybe you file is encoded as full range but there is no color range tag in the file. In this case you may use alias format filter to overcome this problem.
Or it is possible there is some error in ffmpeg plugin. You can try my plugin https://sourceforge.net/projects/vdcachingdriver/, in this case make sure to select "default" as input pixel format.
shekh is offline   Reply With Quote
Old 15th February 2016, 08:45   #3  |  Link
asaleo
Registered User
 
Join Date: Mar 2013
Posts: 27
ffmpeg, virtualdub and histogram

Thanks shekh for rapid answer.
It felt like the "Virtualdub forum time"

My mp4 files comes from GoPro Hero 4 and Canon G9x.

I downloaded the bin_win32.zip and added files to the virtualdub folders.
Histogram is still compressed in "loaded ffmpeg-mp4"-files.

Working with levels (histograms) has shown another thing for me.
Adjusting brightness with the brightness/contrast plugin in Virtualdub changes the histogram. Since "ffmpeg video" is slightly darker than original I increased brightness +5. The result was that the histogram shrinked in one end. The "tateau-video" needed darkening with brightness +10 which shrinked the histogram in the other end.

I will now continue using ffmpeg together with AutoLevel v1,2 and skip the brightness/contrast plugin for my mp4 files.

Regards
asaleo is offline   Reply With Quote
Old 15th February 2016, 10:41   #4  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 776
I made my plugin because I have hero 3 and nothing was interpreting it right out of the box.
It is hard to tell whether you have issue from description. If you want, upload video fragment and pick specific frame.

Tateu quicktime plugin itself does not decode video, so it must be something else involved, like ffdshow. ffdshow has various settings for video levels in many places so it is hard to expect consistent result this way.
shekh is offline   Reply With Quote
Old 15th February 2016, 12:17   #5  |  Link
asaleo
Registered User
 
Join Date: Mar 2013
Posts: 27
ffmpeg, virtualdub and histogram

Thanks shekh
I donīt have ffdshow.
Play everything with VLC.
Used Tateau plugin for opening mp4 files in Virtualdub from 2010.
Changed to ffmpeg plugin some years ago.
Discovered after saving, that video quality was not good.
Returned to the Tateauplugin then because of better quality.
Tried the ffmpeg plugin some times but it never gave me good quality.
I guess that the virtualdub forum has closed at that time when I needed help with this matter.
Regards
asaleo is offline   Reply With Quote
Old 15th February 2016, 14:00   #6  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 776
Ffmpeg decoder itself is ok for quality, gives identical picture as vlc (it too uses ffmpeg).
It is "original ffmpeg plugin" was adding distortions (not sure if they are fixed now). But my plugin must be fine, I fixed everything I could notice.
shekh is offline   Reply With Quote
Old 15th February 2016, 21:19   #7  |  Link
asaleo
Registered User
 
Join Date: Mar 2013
Posts: 27
ffmpeg, virtualdub and histogram

Quote:
Originally Posted by shekh View Post
Ffmpeg decoder itself is ok for quality, gives identical picture as vlc (it too uses ffmpeg).
It is "original ffmpeg plugin" was adding distortions (not sure if they are fixed now). But my plugin must be fine, I fixed everything I could notice.
Good to hear from you again.
I got an idea.
Can you open a mp4 file with the ffmpeg plugin in Virtualdub and use the Autolevel v1.2 filter?
Do you then have the same video quality in window 2 as in window 1?
I see a noticeable increase in quality in window 2, using the autolevel v1.2
If you donīt see any difference then I get that have an own problem.
Regards
asaleo is offline   Reply With Quote
Old 15th February 2016, 14:11   #8  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
What is this "Tateau-plugin" and where can I get it? It looks interesting.


Did you try VirtualDub's Alias Format filter, Color space=(same), Range=Limited.
This tells VirtualDub to expand the range when converting to RGB internally, without an extra levels conversion step.

Use VirtualDub's Levels filter, Show preview, Sample frame to view a histogram within VirtualDub.

How are you exporting frames - with PNG or TIFF images I assume?

Last edited by raffriff42; 16th March 2017 at 23:23. Reason: (fixed image link)
raffriff42 is offline   Reply With Quote
Old 15th February 2016, 22:18   #9  |  Link
asaleo
Registered User
 
Join Date: Mar 2013
Posts: 27
ffmpeg, virtualdub and histogram

Quote:
Originally Posted by raffriff42 View Post
What is this "Tateau-plugin" and where can I get it? It looks interesting.


Did you try VirtualDub's Alias Format filter, Color space=(same), Range=Limited.
This tells VirtualDub to expand the range when converting to RGB internally, without an extra levels conversion step.

Use VirtualDub's Levels filter, Show preview, Sample frame to view a histogram within VirtualDub.

How are you exporting frames - with PNG or TIFF images I assume?
Nice to hear from you raffriff.
I didnīt know of the filters that you proposed.
You are wright of course. I found them and tested them.
Nice to be able to see the histogram within Virtualdub, thanks for that.
I have up till now exported a frame from virtualdub to jpg and opened it in Photoshop Element 12.
I tried your suggested settings but did not get a better video in window 2. I also tried other combinations without getting a better video in window 2
Now it was easier to check the histogram within virtualdub.
Whatever setting I used together with alias format, I did not get a histogram which filled the whole span from 0 to 255.

Histogram for AutoLevel v1.2 however showed a full histogram.
Video in window 2 was also different from window 1
I used another video this time and the difference between window 1 and 2 are too much in this case I think. Have to consider what has happen.
Regards
asaleo is offline   Reply With Quote
Old 25th February 2016, 10:48   #10  |  Link
asaleo
Registered User
 
Join Date: Mar 2013
Posts: 27
ffmpeg, virtualdub and histogram

Quote:
Originally Posted by raffriff42 View Post
What is this "Tateau-plugin" and where can I get it? It looks interesting.


Did you try VirtualDub's Alias Format filter, Color space=(same), Range=Limited.
This tells VirtualDub to expand the range when converting to RGB internally, without an extra levels conversion step.

Use VirtualDub's Levels filter, Show preview, Sample frame to view a histogram within VirtualDub.

How are you exporting frames - with PNG or TIFF images I assume?
I have to make a correction.
Your suggestion to use alias filter actually restored quality of "ffmpegopened mp4"
Settings: Color space: Rec 709 and Color range: Limited gave a full histogram from 1 to 255

All my mp4 files from cameras shares the same Mediainf values.
Color space YUV, Chroma subsampling 4:2:0 and Color Range: Full
Still I apparently have to use Limited Color Range in alias to get a full histogram when opening mp4 files with ffmpeg in VirtualDub
Regards
asaleo is offline   Reply With Quote
Old 7th January 2017, 17:07   #11  |  Link
sorin86
Registered User
 
Join Date: Nov 2014
Posts: 5
How to solve washed-up colors in processed videos (lower contrast, VirtualDub)

VirtualDub misinterprets parameters of the original video such as the Color Space and the Chroma Subsampling. Its automatic interpretation can be cancelled from command Video/Color Depth...

You will find that the "Decompression format” is set to Auto, which causes this problem. Use MediaInfo to identify the original Color Space and Chroma Subsampling of your video/camera and select that specific format from the list, or the best approximation. For example I had to use 4:2:0 planar YCbCr for my Canon compact camera videos. You can leave the Output format as it is.

Another way to repair the lower contrast is the "Alias format" filter, which you have to raise highest in the filter list, if you use more than one filter.

Both these ways will need a bit of trial. I wouldn't recommend using the "Auto levels" filter, although it may produce interesting alterations of the image.

Last edited by sorin86; 7th January 2017 at 17:07. Reason: wrong expression
sorin86 is offline   Reply With Quote
Old 10th January 2017, 17:38   #12  |  Link
asaleo
Registered User
 
Join Date: Mar 2013
Posts: 27
ffmpeg problems finaly solved! thanks sorin86

Quote:
Originally Posted by sorin86 View Post
VirtualDub misinterprets parameters of the original video such as the Color Space and the Chroma Subsampling. Its automatic interpretation can be cancelled from command Video/Color Depth...

You will find that the "Decompression format” is set to Auto, which causes this problem. Use MediaInfo to identify the original Color Space and Chroma Subsampling of your video/camera and select that specific format from the list, or the best approximation. For example I had to use 4:2:0 planar YCbCr for my Canon compact camera videos. You can leave the Output format as it is.

Another way to repair the lower contrast is the "Alias format" filter, which you have to raise highest in the filter list, if you use more than one filter.

Both these ways will need a bit of trial. I wouldn't recommend using the "Auto levels" filter, although it may produce interesting alterations of the image.
Thanks sorin86 for guiding me in the right direction. Now I have same quality in "tateu-video" and ffmpeg-video"

Putting the alias filter first in the filter list solved one problem.

Second problem was solved when I used "Extended options" before opening video file in VirtualDub and changed import settings.
I removed "autodetect". I used: Use 709. Use full range.

With alias first in list, I chosed following settings:
Color space "Rec709" Component range: "Limited"
This settings were the only settings which gave a full histogram.

Checking with "levels" I now got a full histogram of my frame.

I then compared result from three different settings by exporting a frame from VirtualDub to a jpeg.
Tateu-image, ffmpeg image with settings as above and a ffmpeg image with shrinked histogram. (no alias-filter)
Now the tateu-image and the ffmpeg image was of same quality.
ffmpeg-image from video with shrinked histogram was darker, less light.
I tried the levels filter instead of using the alias filter for obtaining a full histogram. The result was not good. Image without ligth. Dull picture.

Conclusion:
Put alias filter first in list.
Do not use "Autodetect" in extended option. Use 709 and Full range.
Settings in alias filter should be: Color space: Rec 709
Component range: Limited.
Do not use "level filter" for repairing histogram for "ffmpeg-videos"

Thanks again for your help.
I am so satisfied for getting the right settings to obtain a good video with ffmpeg.
I have kept to the tateu- plugin as much as possible since it gave me good quality. Together with Deshaker however it lost track of frame numbers when doing Deshaker runnings on only parts of video.
Regards
asaleo is offline   Reply With Quote
Old 15th February 2016, 15:41   #13  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 776
http://www.tateu.net/software/
shekh is offline   Reply With Quote
Old 15th February 2016, 15:51   #14  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 776
Hero files are always tagged "709 FR" (never seen otherwise) and may contain levels below 16 and above 235. So if using straight YUV data as input, Alias Format should be "709, full".
shekh is offline   Reply With Quote
Old 15th February 2016, 21:39   #15  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 776
Maybe I get you wrong, but for me the process is two steps like this:
1) Get picture (this is the work for input driver). Here its enough that picture is preserved without any extra loss
2) Improve picture with filters

So yes having (1) done right does not mean it cannot benefit from levels and other filters. What problem do you want to solve?

Normally without any filters applied both panes must be identical.
shekh is offline   Reply With Quote
Old 15th February 2016, 22:30   #16  |  Link
asaleo
Registered User
 
Join Date: Mar 2013
Posts: 27
ffmpeg, virtualdub and histogram

Quote:
Originally Posted by shekh View Post
Maybe I get you wrong, but for me the process is two steps like this:
1) Get picture (this is the work for input driver). Here its enough that picture is preserved without any extra loss
2) Improve picture with filters

So yes having (1) done right does not mean it cannot benefit from levels and other filters. What problem do you want to solve?

Normally without any filters applied both panes must be identical.
You talk about pictures, I do not understand.
I open a mp4-file with virtualdub and get it in two windows.
Comparing the videos in window 1 and 2 shows the same video as long as no filter is applied.
When I apply AutoLevel v1.2 filter I can see that my video in window 2 changes. I my case the window 2 then shows better quality, fresher and better colours.
What effect can you see applying the AutoLevel v1.2 filter.
Regards
asaleo is offline   Reply With Quote
Old 15th February 2016, 23:01   #17  |  Link
asaleo
Registered User
 
Join Date: Mar 2013
Posts: 27
ffmpeg, virtualdub and histogram

I mentioned to you raffriff42 that I had to consider why there was such a big difference between window 1 and window 2 for this second video that I have loaded and applied AutoLevel1.2 to.
After checking with a frame in PE12 I see that this particular video was taken a very cloudy day with my GoProHD4. Histogram did not go from 0 to 255. Using AutoLevel v1.2 on that video improved quality comparing with original video.
Now I see that that filter can be very useful.
Regards
asaleo is offline   Reply With Quote
Old 16th February 2016, 08:42   #18  |  Link
asaleo
Registered User
 
Join Date: Mar 2013
Posts: 27
ffmpeg, virtualdub and histogram

Something more about the level filter.
The level filter suggested by you riffraff42 can be used instead of AutoLevels v1.2. Since autolevels may give color cast in video with bad histogram, manual adjustment is better.
I also found your site where you show how to use the level filter.
Thanks.

My original problem however was that original video has a good histogram which after loading in virtualdub with ffmpeg plugin showed a histogram not starting from 0 and ending at 255.
In this case the AutoLevel v1.2 filter restores original videos histogram.
Did you shekh see any difference between window 1 and 2 using the AutoLevel filter?
Regards
asaleo is offline   Reply With Quote
Old 16th February 2016, 10:26   #19  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 776
I can have video fragment where autolevels will not do anything and video fragment where it will crop half the range. So this is absolutely pointless.
And you are not specific about ffmpeg. If it is "virtualdubffmpeginputplugin" please mention its version too.

Show your pictures. If you dont know how, postimage.org is very simple way.
Upload frame as decoded, screenshot of histograms, screenshot of file->information, screenshot of video->color depth.

Do not export frames from VD as jpeg. This is pointless way to lose quality. VD jpegs are quite poor compared to "typical jpeg".
shekh is offline   Reply With Quote
Old 16th February 2016, 17:46   #20  |  Link
asaleo
Registered User
 
Join Date: Mar 2013
Posts: 27
ffmpeg, virtualdub and histogram

I will upload three pictures. All is taken from VLC
"ffmpeg-files" are in two versions, taken from videos with and without AutoLevel 1.2
One file is a picture from VLC and original file.
Picture ffmpeg.jpg does not have a proper histogram, the other two has a "full histogram"

Deshaker now crashes everytime I run it on ffmpeg-loaded files.
Error processing frame." Out of memory."
Works perfect with tateau-loaded files.
That problem is of course outside this thread but still annoying.
If you have any idea. please help.
Regards
Attached Images
   
asaleo is offline   Reply With Quote
Reply

Tags
ffmpeg mp4, virtualdub

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 22:04.


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