View Full Version : FFmpeg with VirtualDub gives low contrast, why
asaleo
14th February 2016, 17:02
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
shekh
14th February 2016, 18:52
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.
asaleo
15th February 2016, 08:45
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
shekh
15th February 2016, 10:41
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.
asaleo
15th February 2016, 12:17
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
shekh
15th February 2016, 14:00
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.
raffriff42
15th February 2016, 14:11
What is this "Tateau-plugin" and where can I get it? It looks interesting (https://www.dropbox.com/s/90gq79ekj89c074/translate-Tateau.png?dl=0).
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?
shekh
15th February 2016, 15:41
http://www.tateu.net/software/
shekh
15th February 2016, 15:51
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".
asaleo
15th February 2016, 21:19
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
shekh
15th February 2016, 21:39
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.
asaleo
15th February 2016, 22:18
What is this "Tateau-plugin" and where can I get it? It looks interesting (https://dl.dropboxusercontent.com/u/108089426/Screenshots/translate-Tateau.png).
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
15th February 2016, 22:30
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
15th February 2016, 23:01
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
16th February 2016, 08:42
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
shekh
16th February 2016, 10:26
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".
asaleo
16th February 2016, 17:46
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
shekh
16th February 2016, 17:56
Attachments on this forum are premoderated, nobody except you can see them. So can you reload them to postimage.org.
And please make screenshots of file->information, video->color depth.
asaleo
16th February 2016, 18:49
Mediainfo screen shoots to be loaded
asaleo
16th February 2016, 23:31
Problem running deshaker with ffmpeg solved.
Last update of ffmpegplugin 1841 was the cause for crashes.
Runs fine with v 1836
Regards
asaleo
18th February 2016, 11:53
I loaded files at postimage.org but my files are still pending.
I am however satisfied with the answers which I have received.
I will now use ffmpeg for opening mp4 files in VirtualDub
and edit values in filter "levels" to get good quality videos.
With levels I may also increase quality in video.
Since tateau plugin do not work well with Deshaker I am
happy to leave it.
Thanks to you both for your effort
Regards
asaleo
25th February 2016, 10:48
What is this "Tateau-plugin" and where can I get it? It looks interesting (https://dl.dropboxusercontent.com/u/108089426/Screenshots/translate-Tateau.png).
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
sorin86
7th January 2017, 17:07
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.
shekh
7th January 2017, 17:17
Its old story but got some continuation: https://sourceforge.net/p/virtualdubffmpeginputplugin/discussion/general/thread/7e9c185a/#9667/dab0/5a4d/0b43/b010
tldr: there was a bug in ffmpeginputplugin
asaleo
10th January 2017, 17:38
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
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.