| Printable Version of Topic
Click here to view this topic in its original format |
| Unofficial VirtualDub Support Forums > VirtualDub Filters and Filter Development > Fcchandler Mpeg-2 Plugin Option |
| Posted by: -vdub- Jul 31 2011, 08:17 AM |
| When load a mpeg-2 video can it be made to load with DAR set as default, PAR set as sub option. DAR always for me seems to be the correct AR to be used when viewing. Also have you any consideration and thoughts for supporting ts container with mpeg-2 sd or/and also hd video ? |
| Posted by: fccHandler Jul 31 2011, 11:36 PM |
| I'm not sure what you mean. MPEG-2 video only has DAR information; there is no PAR as in MPEG-1. The DAR is reported to VirtualDub, but there is no way programatically for a plugin to change the aspect ratio of VirtualDub's input/output panes. You have to do that manually as far as I know. I never say never, but for now I have no plans to support Transport Streams. Sorry. |
| Posted by: -vdub- Aug 1 2011, 07:38 AM | ||
| Hi ffcHandler i have uploaded two small samples that show this problem. Clips chosen have round circles to tell correct AR or not when loaded into virtualdub. The .mpg file with g-spot shows the PAR is not 16:9 where the DAR is 16:9 When loaded in virtualdub they show with 4:3 type AR not the correct AR of 16:9. These cannot be re-sized from loaded 4:3 type to correct AR 16:9 using the internal virtualdub resize filter or the VDModResize filter. Other mpg (mpeg-2) i have noticed having this problem includes also all dvd videos. That when checked with g-spot shows DAR having correct AR. When loaded into virtualdub the AR shown always using wrong AR of PAR not the correct AR of DAR.
.ts included for when you decide to do a .ts plugin |
| Posted by: fccHandler Aug 1 2011, 02:19 PM |
| I still don't see a problem, and I surely don't know what you mean by "cannot be re-sized". You can resize the video to any size you want. If your complaint is that the video input/output panes are the wrong size, I have no control over that. By default you see the video at its true size (720 x 576, for example). If you want to see it in a different size then you have to change the AR manually, as I said. For example, load PAR-DAR.mpg then right-click on one of the video panes. In the aspect ratio column there are several choices; the one labeled "Source" is the aspect ratio reported by the MPEG-2 plugin. |
| Posted by: -vdub- Aug 1 2011, 03:14 PM |
| Open mpg with virtualdub, open resize filter and click on preview. Notice how the preview is showing the AR of PAR 1.422 (~10:7) the correct AR for the video is DAR 1.778 (16:9) Load with VDMod_Resize filter and will see the AR the video is loaded with PAR 1.422 (~10:7) not real AR which should be DAR 1.778 (16:9) Try to use either filter to resize to same as source video DAR 1.778 (16:9). Nearest i can achieve is 720v405 that give true ratio +0.000% 1.777777777777778 to 1 which you will know is 1.778 (16:9) that is the same value the mpg video has for its DAR 1.778 (16:9) The video has been loaded with wrong AR using PAR instead of DAR value. test with win os video players (using default settings) mpc, vlc, wmp and mpc-hc all show with using the DAR 1.778 (16:9) value You can also find the same if dump a dvd raw to vob or load dvd in an editor shows the video true AR used would be DAR. Play the video and will see that DAR is the AR used and never yet the PAR value s the video loads with PAR and not DAR working with video and saving with correct resolution and AR of source mpg 720x576 1.778 (16:9) is not possible atm A reason for choosing those clips it also shows you that the circles are not circular for example with the earth exploding PAR-DAR.mpg. That in the resize filters preview it is egg shape not round as it should be. |
| Posted by: dloneranger Aug 1 2011, 03:41 PM |
| it's a standard pal dvd with the video stream marked as 16:9 video players see that flag on playback and automatically resize it to the correct width/height 1024x576 virtualdub works with square pixels though, so a plugin that did the same as video players do would have to a lot of lying to virtualdub and resize the video frames themselves that's a lot more work than just adding the resize filter (admittedly, it would be useful if the resize filter had the option to resize the width based on the height, not the other way around as it is now) I don't think I'd want the plugin to automatically resize the video though, as after editing you can currently add the video back to an mpeg encoder as-is, without having the pluing resize it to 16:9, and then have to resize it back to 720x576 |
| Posted by: fccHandler Aug 1 2011, 04:06 PM |
| OK, there is something weird happening. You are correct that the plugin reports the AR to VirtualDub as 1.422:1. This math came about after toying with the input/output panes to get correct results. I determined that the PAR was the value VirtualDub wanted in its GetStreamSourceInfo() query, and it makes sense because the name of the field we fill in is VDXStreamSourceInfo.mPixelAspectRatio. However, the resize preview window behaves in a totally different manner from the input/output panes. Note what happens when you right-click the preview window and choose the following in this order: 1.422:1 pixel (Source) 16:9 frame (Wide) 1.422:1 pixel (Source) The first time you choose 1.422:1, you get an incorrect AR. Then switching to 16:9 gives a correct AR, then switching back to 1.422:1 doesn't change the AR! This seems to be a bug in VirtualDub's resize filter. |
| Posted by: -vdub- Aug 2 2011, 05:35 AM | ||
| Which means that not only virtualdub internal resize filter is incorrect. But hard to believe that far better VDMod_resize filter is also incorrect. Since it shows far more in the filter than virtualdub own resize filter does. While also ben extremely helpful in making adjustments easy to do. This was the reason i though that the video decoder itself was at fault. The only player i see that does upscale to 1024x576 for playing is mplayer. Where if load into say mpc or mpc-hc with Video Frame > Normal Size and Keep Aspect Ratio doesn't show the video as 1024x576 but as resolution of 720x576. Also as said g-spot also reports what the actual resolution is 720x576. I know 720x576 and 1024x576 are true AR for 16:9 whether all tv broadcasters film in higher resolution than 720x576 for sd unknown. The bbc from which the clips are from, captured digitally years ago. The bbc do film 16:9 for sd only at 720x576. That said i know if upscale the videos using the resize filters with virtualdub to 1024x576 does then show correct AR (upscaled corrected AR). Then the problem next that the videos are interlaced during processing will remain the same, with no de-interlaced applied. Upscaling interlace is not recommended even says so on the resize filters also would prefer not to upscale or downscale the video. Needing the video able to load into virtualdub to process using the video source DAR 1.778 (16:9) I suppose then we are at the point of seeing what phaeron has to say or can do for this if a virtualdub problem. Still feeling virtualdub will only display what the decoder loads. The decoder or virtualdub which is the one that's unable to load and use the DAR info from the video loaded. As said happens with pal dvd videos, a few infos from g-spot (have not ntsc dvd to test). The DAR is always used for correct AR when playing.
Also load these clips into videoredo for example and see how it does edit and playback is using correct AR. Other mpeg-2 editors also do the the same. Are you sure it could be virtualdub or its filter that is at fault and not the mpeg-2 decoder ! |
| Posted by: fccHandler Aug 2 2011, 05:05 PM |
| The AR information is never used by the plugin. You can browse the source code and see for yourself. All I do is report it to the user via the File Information dialog, and pass it to VirtualDub via his GetStreamSourceInfo() query. What he does with the info is out of my control. It isn't explicitly stated in the plugin SDK, but based on the name of the field (mPixelAspectRatio) and the behavior of the input/output panes, I assume the PAR is what he is asking for. If that is an incorrect assumption then we will need Avery Lee to clarify... |
| Posted by: phaeron Aug 8 2011, 12:44 AM | ||
I tried to reproduce the issue with the resize preview window, and couldn't do so on either 1.9.11 or the dev tree -- the result was a 16:9 window each time. Any chance you guys are running at a low desktop resolution that might force the window to resize on initial display?
I don't understand what you're saying here. The pixel aspect ratio (PAR) and the display aspect ratio (DAR) are related through the encoded resolution of 720x576 -- there is no difference between a PAR of 64:45 = ~1.422 and a DAR of 16:9 at that resolution. A frame encoded with a specific resolution and displayed at specific frame size has both a specific PAR and DAR. |
| Posted by: -vdub- Aug 8 2011, 10:51 AM |
| The pc i use virtualdub monitor display is set to 1600x900 - 32bit - 60 hertz. I see the same using virtualdub directx or opengl settings These below are with using fccHandler MPEG-2 plugin filter with the PAR-DAR.mpg clip ![]() After loading clip (notice the earth is eliptical (egg shaped) not round as would be if was showed at 16:9) Sure can adjust to force 16:9 here but it should be loading as 16:9 to begin with (prefer not to force to display 16:9). Also note if force display to 16:9 it doesn't change what is shown below. ![]() Internal Resize filter preview (with no resize adjustments made notice the display is showing 5:4) (display should be 16:9 same as video source input) (elipcal egg shaped again 5:4 would be round if 16:9) ![]() VDMod_Resize filter (after opened with no adjustment made) (notice 5:4) (should be 16:9 same as video source input) ![]() VDMod_Resize filter (16:9 adjustment made notice pixel size has changed from 720x576 to 720x405) (It does preview as 16:9 but has lost resolution i need as video source 720x576) ![]() VDMod_Resize filter (16:9 and also round to multiples of 16x16 adjustments made. Note also the Output Aspect Ratio is no longer true AR) Other video softwares, dvd authors, editors etc, show the video as 720x576 16:9 on load, editing, adjusting and after saving. I need need to use virtualdub instead of other tools for processing. |
| Posted by: -vdub- Aug 8 2011, 11:16 AM | ||||
| Media Player Classic - Home Cinema http://img84.imageshack.us/img84/4974/mpchcfs.jpg http://img29.imageshack.us/img29/3341/mpchcvideoframe.jpg http://img189.imageshack.us/img189/8933/mpchcvideoinput.jpg http://img217.imageshack.us/img217/7910/mpchcvideooutput.jpg
[edit] Images were breaking the board layout |
| Posted by: stephanV Aug 8 2011, 05:08 PM | ||
It really shouldn't. Anamorphic content is stored, well, anamorphic and any automaic alteration on the editing display is possibly harmful to the editing process. There is no sense in comparing it to what a player does because an editing tool is not intended for playback. I think you are confused about what anamorphic really means. |
| Posted by: -vdub- Aug 8 2011, 09:06 PM |
| Anamorphic well they could i have no idea or care, but for me that is not the issue. The issue is it doesn't display on load correctly with virtualdub and also all other processes such as the filters. Cannot work with a video if the editor doesn't load and work with the actual source ar and resolution. With many mpeg-2 editors i have tried they all load and work with these videos correctly using source video ar and resolution. Also dvd author tools all work with videos and process them using correct ar and resolution. I do not force any tool to do this, they actually know are correct ar and resolution to use and do use them. Though i also need to use virtualdub with these videos i prefer virtualdub with its features, ease of use and the various filters available for use to process a video further when needing to do so. As a side note for Phaeron have a look at virtualdub mpeg-2 (that maybe fcchandler modified) v1.6.19 (build 24586\release). Load the clip and notice the display is correct and also so is the information for the loaded source clip. Though the filters are still wrong same as virtualdub screen images show above. Virtualdub code need modifying maybe so is able to do the same, for main display, plugins and other processes. Why mpc-hc images posted since often read on forums people asking is what does it look like in mpc. So put those images there just in case the question is asked. Also same for mpeg-2 decoder in/output pins data. |
| Posted by: stephanV Aug 9 2011, 04:44 PM | ||
Virtualdub displays how the video is stored. Any automatic alteration of that is possibly harmful. The AR is just a flag and I think if you want to do video editing you should educate yourself at least a little in this matter. VirtualDub is not doing anything wrong. It maybe is not doing something you expect it to do, but that is, bluntly said, your misunderstanding. |
| Posted by: phaeron Aug 9 2011, 08:43 PM |
| VirtualDub has to work in an environment where the aspect ratio may not be preserved, and as such it would be misleading if it were to display a different AR than what you'd be likely to get. Therefore, the default is still 1:1. You can still choose the display aspect ratio that matches your output medium. As for the aspect getting whacked in resizing, that's what padding the frame size to 16x16 multiples does. There is no possible way the aspect ratio can be preserved if you are using an option that changes the image size itself. In order to avoid that you would need an alternate mode that either letterboxes or crops or to use an output format for which that is unnecessary. |
| Posted by: -vdub- Aug 10 2011, 03:53 PM |
| I don't want to resize any mpeg-2 videos i have. I used resize filters values to show to you the resolution problem with all the filters. That none are able to use the source video resolution and AR for 720x576 with 16:9 I've had a further look at this. Saving to uncompressed avi for tests. The best virtualdub at the moment can output is a 5:4 720x576 with 16:9 framed inside it. The big drawback it now has black bars top and bottom of the video. Virtualdub any version right now including any exotic custom virtualdub builds. Loaded with mpeg-2 720x576 16:9 (dvd full d1 specification) are all bad maintaining the same input source video resolution and AR for all processing. Phaeron any plans for virtualdub to have full mpeg-2 internal support. Where this problem would be corrected for all processing including the filters ? |
| Posted by: stephanV Aug 10 2011, 04:51 PM | ||
AVI doesn't have an AR flag so this is no surprise. As long as you don't want to understand what anamoprhic is, there is no point in further discussion. |
| Posted by: -vdub- Aug 10 2011, 05:49 PM |
| http://en.wikipedia.org/wiki/Anamorphic_widescreen So your thinking this video is 4:3 with 16:9 frame inside ? You do realize all mpeg softwares load using the DAR value which is 720x576 16:9 that i have tried. Using no other AR such as 4:3 or 5:4 or any other. If load a mpeg-2 video i have into dvd author software and it to use strict dvd D1 spec only (with no compromise settings set). Will author to dvd without issue at using full d1 specification. You know info tools such mediainfo or g-spot report the video as 720x576 16:9 dvd spec they wouldn't do so if it wasn't so. Anamorphic is a cop out and is frowned upon by the whole industry i have read. And i can see the reason why. Even older dvd were butchered using it and public outcry put an end to that. Or are all the film studios they still secretly using it for dvd movies! Got a video that cannot do anything with use anamorphic. Much like what i did with the test using avi with avi sees AR or not. Do the same test using external mpeg encoder will still give same result. And that was the anamorphic test i did. Sure could of done it in a 4:3 frame with 16:9 inside. Same process that i had just tested using the sar 5:4 value instead. Ok maybe your on the right track as these are from digital tv captures. As are sd would mean have to fit on 4:3 tv screen even if we all mostly have 16:9 tv now. And maybe would account why the sar is 5:4 so means near 1:1 not quite 4:3 but near it. So that all these other softwares are using image aspect ratio or picture aspect ratio DAR to work with instead of SAR or PAR to load and process with. Still doesn't mean virtualdub or a mpeg-2 plugin code couldn't be modified to to do so also. Like all the other softwares out there have done to work with these mpeg-2 which also are same with new dvd films. That said i only mention dvd to show what i have is the same. I don't bother with retail dvd haven't the time to do so. Virtualdub doesn't see the mpeg-2 video correctly. There must be code around to implement this into virtualdub since every other software is doing this correctly for mpeg-2. Or maybe developers learned the easy way to do this and use DAR since is always holds the correct information for mpeg-2 videos. |
| Posted by: stephanV Aug 11 2011, 05:04 PM | ||
There are no non-anamorphic DVDs (in the broad sense). DVD is based on a analog standard where samples (the equavalent of pixels on a computer) are non-square. 720x576 will only look correct on an analog television. On a display with square pixels (such as all computer displays are) these videos are resized by the player (say to 1024x576) to look correct. What you are asking for is to let VirtualDub also automatically do this resizing, but this would either be an unwanted operation when the resizing is also done on saving, or it would be lying to the user when it is only used for display. AVI doesn't have an AR flag so what you see is not what you get then. So no, your request does not make sense. |
| Posted by: -vdub- Aug 12 2011, 02:57 AM | ||
| As said all mpeg-2 softwares i have tried. Do load these mpeg-2 video correctly and able to display, process and save using the DAR image/picture aspect ratio. Which could mean virtualdub could do the same also. For me its not about pixel square or not, anamorphic or any other. Its about using the DAR values correctly to display, process and save. Also maybe could even use the MAR (movie aspect ratio) which i understand for mpeg-2 uses also the DAR values. So if all these softwares can use it so also could virtualdub with code change or code addition.
After dar bug fixed that has been posted here http://forums.virtualdub.org/index.php?act=ST&f=7&t=15093. Maybe will correct this problem. |
| Posted by: stephanV Aug 12 2011, 05:07 AM | ||
For the third time, you *cannot* save an AR flag in AVI. Yes you can do this in MPG, but VirtualDub only supports exporting to this format through external encoders, over which it has no control. The problem here is not displaying the video correctly, that is easy. The problem is that by displaying something in a certain way a user also expects something, and living up to these expectations is what VirtualDub cannot do without potentially breaking the video. What you see you should always be what you get. If some users do not *understand* what they see, is a whole different issue. And it can't be fixed with code. |
| Posted by: -vdub- Aug 12 2011, 06:09 AM |
| All softwares was implyied as 'all of the mpeg-2 softwares i tried'. So i loaded a mpeg-2 to videoredo to change the par flag. I save it changing the header to 2:21.1 g-spot show par changed to 2:21.1 Loaded video into videoredo and still the same problem. So confirmed that SAR is the values that virtualdub is using. Is there a small free tool that can change the SAR value. For mpeg-2 video without encoding or transcoding ? |
| Posted by: -vdub- Aug 15 2011, 04:13 PM |
| This video always uses the sar value of 5:4 with virtualdub maybe meaning 1:1 is the sar value or first value seen in mpeg video. I never intend to resize these mpeg2 videos. But maybe i can work with them at 1024x576 using raytheOn FFMpeg Input filter. So when i load the video all displays and all filters are 1024x576 16:9. I could then do video filter work and within the same process resize back to 720x576 and 5:4 sar will return. Output using external encoders for mpeg2 transcode. I am still concerned about the warning that VDMod_Resize filter shows Interlace (not recommended for enlarging). My thoughts for deinterlace has been not to deintelace let the tv hardware do it as it is designed to do. Also is better than any software deinterlacer with these videos. I did a big search and is still no clearer what the problem would be for enlarging interlace video to 1024x576 and back within the same transcode process. Except something to do with vertical resolution been smaller than the horizontal resolution, what is all that about ? Any other known problems also when enlarging interlaced video resolution ? Does virtualdub use an internal frame server to process video using raw avi and that this avi is 1:1 square pixel shape ? 1:1 pixel from Phaerons post above. Also 16x16 multiples what is the correct one to use for 1024x576 16:9 and 5:4. which i may need to use for processing or resize back to 720x576 5:4 ? Or is the 16x16 referring to picture quality quantization compression matrices intra | non-intra that each 8x8 together maybe represent the 16x16 ? |
| Posted by: stephanV Aug 15 2011, 06:59 PM | ||
And there we get to the whole point. The thing you are demanding here is actually that VirtualDub should resize the video. You don't want that, so VirtualDub is already doing exactly what you want. |
| Posted by: -vdub- Aug 15 2011, 11:04 PM | ||
| Only doing so if i use FFmpeg Input Driver with option selected so it does so. Otherwise it displays and edits as 720x576 5:4 ar. Which is is wrong pixel shape for the 16:9 resolution. If you read on the next sentence goes on to say.
Meaning if i need to process the video that i will need to use 1024x576. The post was written to learn more about the pitfalls of doing this. The reason for asking those questions in the post. |
| Posted by: stephanV Aug 16 2011, 04:49 AM | ||
The pixel shape is a flag. Digital pixels have whatever shape you want them to be. It's irrelevant for filtering. |
| Posted by: -vdub- Aug 16 2011, 04:19 PM |
| Your replies so far haven't exactly answered any questions from the initial post. That I posted Aug 15 2011, 04:13 PM |
| Posted by: -vdub- Aug 16 2011, 04:31 PM |
| <> |
| Posted by: stephanV Aug 16 2011, 04:54 PM |
| The initial question does not make any sense. 1. You don't need to resize. 2. For filtering the pixel shape is irrelevant. |
| Posted by: -vdub- Aug 16 2011, 10:16 PM |
| So what your saying for this video clip (link above) using any filter with any ar makes no difference. I'm at a loss there putting editing itself to one side since ar doesn't matter for that. I have always read that when make changes to a video it has to be done using the correct ar. Now i could mention many filters now (again not null transform or resize ones). The way i see it a virtualdub filter process when complete will have modified the video and so an encode was part of the process. And would need to be done using the correct ar as video is at that time a filter is applied. Another way i look at it how many 5:4 pixels can fit inside a 16:9 pixel more than one. Use a filter at 5:4 and the video actually is 16:9 only part of each 16:9 pixel will be processed. Or do you thinka video is always 1:1 pixel square not matter the ar it says it is. Have a look at the 2 picture top right of this web page, one square one rectangle. http://en.wikipedia.org/wiki/Pixel_aspect_ratio |
| Posted by: stephanV Aug 17 2011, 04:46 AM |
| A pixel on your display has a shape, a pixel in a digital file doesn't have any shape. It's normally just 3 8 bit values telling what color it is. A filter doesn't work on the pixels on your display, it works on the pixels in a digital file. |
| Posted by: -vdub- Aug 17 2011, 05:56 PM |
| That reply has just cemented what i needed to know. Something that all sites i have visited over the years have failed to mention. From your reply i can easily see no matter what is displaying on the computer screen at any time makes no difference. Any filter or encoding will if chosen to alter all pixels and the sub macro blocks. As you say the AR is only a flag which can be changed at any time much like Fourcc flags can be. Great i appreciate you getting to this point i now understand in this one thread more for video than years of reading. Thank You Any know tool for mpeg-2 that can change the SAR flag value. For example with restream i can change PAR and DAR even remove them both with only SAR remaining using ar of 1:1. Yet cannot find any that can change the SAR flag which i would like to do. Internet searches i have found can adjust any ar flag seen with gspot for xvid, divx, h264 and mkv i think. Any MPEG-2 tool that can change the SAR flag value ? |
| Posted by: Placio74 Aug 17 2011, 09:08 PM |
| If I'm not mistaken... there is no SAR flag. Slightly simplifying, SAR it's just ratio of frame width/height (horizontal to vertical resolution). So obviously, additional flag is not needed (height and width value are sufficient). BTW Some data provided by GSpot (and not only) are result of analysis and calculation. |
| Posted by: -vdub- Aug 18 2011, 10:26 PM |
| Then to change the sar video would need to be encoded again. Since 720x576 isn't a perfect ar for 16:9 sar value only will show 16:9 when the actual video is a perfect 16:9 ar. Perfect 16:9 resolutions http://www.videohelp.com/tools/Aspect_2 that i used here. Doesn't show any of the high definition (HD) resolution information's atm. Problem with 16:9 and dvd is that dvd isn't made for 16:9 video instead actually everything is anamorphic so sad they had a chance instead butchered it to nothing. Better then to use BD or BDXL only for 16:9. Is there a tool as Aspect v2 that also will show also HD resolutions ? Here's a list of perfect AR for 16:9 from Aspect macroblocks 32x32 512x288 1024x576 macroblocks 16x16 256x144 512x288 768x432 1024x576 macroblocks 8x8 128x72 256x144 384x216 512x288 640x360 768x432 896x504 1024x576 Macro blocks are video colour bits which also can be individually encoded to different I|P|B and intra frames ? A quick test to evaluate this with ffmpeg default 16x16 macroblocks. Encoded to 512x288 and 1024x576 each video now has sar value of 1.778 (16:9) and will load to virtualdub using correct ar of 16:9 Still wonder each macro pixel will be square in shape since 16x16 is square. Are there 16:9 macro blocks to be used, maybe 8x16 or similar to match 16:9 or does the 16x16 fit inside a 16:9 pixel perfectly. Or maybe it is taht i have misunderstood something while reading informations for this. |
| Posted by: phaeron Aug 23 2011, 05:15 AM |
| Macroblocks are blocks of pixels that are grouped together for compression reasons. There are two fundamental operations in modern video compression that requires such grouping: motion prediction and image transform. The macro blocks are always in raw pixels, so if the aspect ratio causes non-square pixels, the macroblocks will also be non-square on screen. |