View Full Version : Widescreen MPEG-2 to 387x218 MPEG-1 possible?
TakuSkan
16th March 2006, 09:26
I'll be darned if I can figure out how to get tmpgenc to take a 16:9 widescreen MPEG-2 file ripped from a DVD, and transcode it to a custom aspect ratio in a MPEG-1 format of, say 387x218 that I >think< would work well for my purposes.
A while ago, Boulder guided be through the process here (http://forum.doom9.org/showthread.php?p=786377#post786377) for transcoding a 16:9 MPEG-2 to a 16:9 MPEG-1 file successfully using DGIndex, FitCD and temgenc. In the end of that process, I was able to use tmpgenc's wizard to create a 352x240 VCD from an avs script created by FitCD. I >think< the actual video component of the letterboxed output was 352x198... a bit small.
I'd like to get the video component to display on screen with the same overall area as the a full 352x240 (or stretched out to 640x480 when displayed?) VCD file which my notebook is barely able to run. I may or may not be right on targeting a file with the video component size of 387x218. I'm not clear on how letterboxing is involved in figuring these things out.
But my end objective is to be able to create something a bit larger than the VCD I produced with Boulder's help, and one that my old Toshiba Libretto 110 PI 233 would be able to play via the old Windows Media Player v6. WMP6 turns out to demand less resources from the system than Media Player Classic.
I've attempted to modify the avs files FitCD has produced in order to get tmpgenc to produce a larger video image. But I just don't seem to be able to get a handle on what's really all involved there.
And I've totally failed at getting FitCD to produce a script to do the job.
I tried fooling around with the pixel sizes using tmpgenc from scratch without the wizard, as at this point I've gotten pretty good at modifying the video bitrates and other settings to produce a VCDs from TV captures. I found by actually increasing the pixel value for the >vertical< component of the aspect ratio, that I could get the horizonal component of the widescreen 16:9 video file to stretch out properly in the output file. (??) But though the resulting file plays with the proper aspect ratio with WMP v9 on my WinXP system, the image is smaller than it should be running it through WMP v6 on the Libretto and Win2000.
Has anyone attempted tp do this sort of thing successfully? Any help would be greatly appreciated.
Thx,
TS
setarip_old
16th March 2006, 09:41
Perhaps I'm misunderstanding your question but, in TMPGEnc you can simply click on the "Settings" radiobutton, select the "Video" tab and change the "Size" to whatever dimensions you desire...
Mr_Odwin
16th March 2006, 09:52
I've just tried this and got it to work fine.
I cancelled the wizard, loaded the VCD mcf, loaded the unlock mcf, went into settings and under the video tab I changed the video size to 384x288 (as your required size was illegal apparently) and set the aspect ratio to 1:1 (VGA). Started it, and it produced the required file.
foxyshadis
16th March 2006, 10:07
The basic idea is you'd like to know how to create an anamorphic VCD, right? If you already succeeded on XP, the only reason it won't work on 2k is different DShow filters. Find out what XP uses during vcd playback (might need to use another player to find out, or graphedit), and install that on 2k if possible. Or did I misread?
TakuSkan
16th March 2006, 10:17
Perhaps I'm misunderstanding your question but, in TMPGEnc you can simply click on the "Settings" radiobutton, select the "Video" tab and change the "Size" to whatever dimensions you desire...
Problem is that TMPGEnc will often reject custom A/Rs as being invalid. But if I try creating a VCD from a widescreen 16:9 MPEG-2 file, which I can do successfully manually or with the wizard, the A/R of the output file is all wrong. Too high and stretched vertically. The only way I've gotten the outpu A/R properly is to feed TMPGEnc an avs file as Boulder showed me.
I've just tired this and got it to work fine.
I cancelled the wizard, loaded the VCD mcf, loaded the unlock mcf, ...
Okay... that sounds great. What the heck is the mcf though?? Load the mcf... and unlock the mcf??
Edit: Ah... TMPGEnc > Load > (various mcf files I see there...)
Did you take a 16:9 widescreen MPEG-2, and get an 384x288output file with a reasonable widescreen A/R?
Thx,
TS
Mr_Odwin
16th March 2006, 10:26
Actually no, I got a 4:3 file but that's my fault for not reading your post properly. You should use 384x216 with a 1:1 aspect ratio.
TakuSkan
16th March 2006, 10:30
Or did I misread?
No... it seems you've correctly spotted my having produced a file that looks good on WMP v9 in XP. But what I created wasn't strictly a VCD if that matters, as I'm pretty sure there are parameter standards for them I broke when I transcoded the MPEG-2 to a custom MPEG-1 file manually.
I just tried all combinations of vertical and horizontal pixel settings until I came up with 416x384 that created letterboxed output with video that looked like the right A/R, or one pretty close.
Not quite sure how to spot what XP's using as a filter, and how to get it set up on 2000... but it sounds like a good route to try.
TS
TakuSkan
16th March 2006, 10:45
Actually no, I got a 4:3 file but that's my fault for not reading your post properly. You should use 384x216 with a 1:1 aspect ratio.
Okay... that does get me to where I can customize things, and am able to create output with proper looking output. But oddly by increasing the vertical pixel value, and not the horizontal value as I would have thought.
I'll try the file in WMP v6 in Win2000, but I'm going to guess it's going to have the same playback problem as the one I created earlier successfully with the 416x384 A/R.
The file created with the DGIndex/FitCD process Boulder outlined (again here (http://forum.doom9.org/showthread.php?p=786377#post786377)) had no problems at all playing in Win2000 & WMP v6 on the Libretto.
Mr_Odwin
16th March 2006, 11:10
Can you provide a small sample of your source material?
TakuSkan
16th March 2006, 11:18
Well... WMP v6 in Win2000 is displaying the 384x216 video in exact pixel proportions as a bmp frame capture. I changed that to 384x336 which shrank the vertical component (??) down to where it looks a bit better. Maybe I need to stretch the horizontal a bit now, and play with vertical a bit until I get something larger.
But something's still wrong. The resolution of this video is greater than the successful file made to VCD standards I made using Boulder's method. Yet WMP v6 in Win2000 is displaying it SMALLER than that VCD file. I think WMP, and maybe all good media players probably resize files made to certain standards, stretching them to fill a larger NTSC 640x480 screen. Then maybe it just leaves the resolution of the odd sized video files as they are when it displays them.
If that's true... I don't know if I'll be able to transcode a 16:9 MPEG-2 file from a DVD to anything that WMP v6 is going to display any larger than what I've already produced via Boulder's method.
This old Libretto has a 800x600 screen. It'd sure be nice to create something that would stretch the image wider than the 640 pixel width of the VCD file I've made successfully from an avs file.
TakuSkan
16th March 2006, 11:21
Can you provide a small sample of your source material?
I have a 24MB 63 second clip I could trim a bit, or upload somewhere as is. I don't have any file space online anywhere to put it though.
Mr_Odwin
16th March 2006, 11:25
Try this: http://rapidshare.de/
Nice and free for this sort of stuff. You can upload files of up to 100MB.
TakuSkan
16th March 2006, 11:46
Try this: http://rapidshare.de/
Okay... that was easy. I trimmed my clip to 10 seconds @ 4.4MB and uploaded it here:
http://rapidshare.de/files/15633289/Ap13_clip2.mpg.html
I've also uploaded a clip from the VCD file that plays properly:
http://rapidshare.de/files/15633636/Ap13_VCD2_clip1.mpg.html
However more and more it seems that I'm going to be limited by the 640x480 NTSC display screen A/R of WMP v6. I'm beginning to doubt I'll be able to get any video file to stretch to close to 800 pixels wide with WMP v6.
Mr_Odwin
16th March 2006, 12:47
It may seem more faffy but I think you should use an avisynth script to frameserve it to tmpgenc if that's your encoder of choice.
It is telecined material but is easily fixed by using DGIndex with the file and then forcing film in the Video>Field Operation menu. In your encoded file you deinterlaced and end up with unnecessary blurry footage. Save the project and you'll be left with a d2v file and (if you demuxed the audio) an ac3 file too. Open this using in tmpgenc with a script like:
LoadPlugin("C:\PROGRA~1\GORDIA~1\DGMPGDec\DGDecode.dll")
Video=mpeg2source("C:\Documents and Settings\James\My Documents\Ap13_clip2.d2v")
Audio=directshowsource("C:\Documents and Settings\James\My Documents\Ap13_clip2 T01 3_2ch 448Kbps DELAY 66ms.ac3")
Audiodub(Video,Audio)
DelayAudio(0.066)
crop(0,60,718,362)
lanczosresize(384,160)
Load the videocd (ntscfilm) and unlock templates, under the video tab change the video size to 384x160 and the aspect ratio to 1:1 (VGA). Then change the audio options, rate control mode and motion search precision if you want. Ok it, and press start.
You should get this:
http://pike.fireflyinternet.co.uk/Ap13_clip2AVISynthed.mpg
TakuSkan
17th March 2006, 10:45
It may seem more faffy but I think you should use an avisynth script to frameserve it to tmpgenc if that's your encoder of choice.
.... <snip> ....
You should get this:
http://pike.fireflyinternet.co.uk/Ap13_clip2AVISynthed.mpg
Fantastic Mr_Odwin. Just what I'm looking for! But now I have about a 100 questions, and will have to pare them down and prioritize things. I need to learn how you figured this out so I can apply the process to transcoding other DVD files in the future.
* 1st, how did you determine the aspect ratio of 384x160? And will that likely apply to most all 16:9 widescreen DVD material?
* What does the fact that the source was telecined tell you, and what about it needed to be fixed? I guess the deinterlacing and fuzziness. I'm wondering what DGIndex did to fix it.
In your encoded file you deinterlaced and end up with unnecessary blurry footage.
* How did you determine the file to be deinterlaced? I'm not quite sure how that happened.
Lets see. I used DVD Decrypter to rip the VOBs, VobMerge to merge the main movie VOBs on the DVD to one VOB, used VideoReDo to convert that to an MPG, and then ran VideoReDo again to create the small clip. I guess something caused the de-interlacing in the process.
* Can you recommend a better way to go about that without deinterleacing the source? I didn't realize that happened.
Save the project and you'll be left with a d2v file and (if you demuxed the audio) an ac3 file too. Open this using in tmpgenc with a script like:
LoadPlugin("C:\PROGRA~1\GORDIA~1\DGMPGDec\DGDecode.dll")
Video=mpeg2source("C:\<clip>\Ap13_clip2.d2v")
Audio=directshowsource("C:\<clip>\Ap13_clip2 T01 3_2ch 448Kbps DELAY 66ms.ac3")
Audiodub(Video,Audio)
DelayAudio(0.066)
crop(0,60,718,362)
lanczosresize(384,160)
Okay... I got that to work, and modified it using it as a template to run on another couple test files successfully. But I'm confused by a couple things.
To process the whole movie, I ran the full file through DGIndex forcing film as you describe. The main ac3 audio track didn't have any audio delay as the clip did. Could that be right? I modified the DelayAudio(0.066) line to read DelayAudio(0.000) as reflected by the ac3 filename DGIndex had output. This seems to work.... yes?
Could you explain the crop(0,60,718,362) and lanczosresize(384,160) lines? Hopefully I can just apply them to future 16:9 transcoding processes... though there are so many apsect ratios, and I'm so very new at all this.
Load (Ed: Into TMPGEnc) the videocd (ntscfilm) and unlock templates, under the video tab change the video size to 384x160 and the aspect ratio to 1:1 (VGA). Then change the audio options, rate control mode and motion search precision if you want. Ok it, and press start.
I loaded the avs file and did as you detailed, and all went well, outputing an mpg file that plays properly in the Libretto.
Checking TMPGEnc's 'Advanced' menu, I see by default by the way things were loaded here that 'Video Source Type' is set to 'Non-interlace (progressive)', and 'Field order' to 'Bottom field first (Field B)'. I left things that way and presume it works, as you pointed out the video had been deinterlaced... right?
I'm guessing that if I manage to figure out how to create an mpg file from source VOBs without deinterlacing, I might have to reset the settings above on TMPGEnc's 'Advanced' menu to 'Interlace' and 'Top field first (Field B)'... yes?
There's so much to learn about the various components and procedures you've worked out for me here Mr_Odwin. I hope I can track down more explainations of just what all is involved so I can start to work these things out for myself.
Thanks so very much for sorting out so much of this Mr_Odwin. I appreciate your feedback on this tremendously. Getting this little Toshiba Libretto to play widescreen DVD transcoded files will be a blast!
TS
TakuSkan
23rd March 2006, 08:16
I wonder if someone might be able to offer a little feedback. I need to modify the values Mr_Odwin arrived at for crop(0,60,718,362) and lanczosresize(384,160) in the avs script he provided me (below). He had worked out the script based on the test video file (http://rapidshare.de/files/15633289/Ap13_clip2.mpg.html) I had posted, and I now need to transcode video with 16:9 & 1.85:1 aspect ratios.
LoadPlugin("C:\PROGRA~1\GORDIA~\DGMPGDec\DGDecode.dll")
Video=mpeg2source("C:\<clip>\Ap13_clip2.d2v")
Audio=directshowsource("C:\<clip>\Ap13_clip2 T01 3_2ch 448Kbps DELAY 66ms.ac3")
Audiodub(Video,Audio)
DelayAudio(0.066)
crop(0,60,718,362)
lanczosresize(384,160)
I've been doing a little homework on film and DVD apsect ratios, and have realized that the test sample I was working on here was actually a 2.39:1 'cinescope' format, not 16:9 as I had written at the top of this thread. And that probably the most common A/R used in film and DVDs these days is: 1.85:1
Can someone tell me how to figure out what values I need to enter into the 'crop' and 'lanczosresize' lines in that avs script to be able to process DVD files with A/R values of 16:9 & 1.85:1 to the custom VCD format I'm looking for here?
Again, the objective has been to pruduce a custom VCD file without letterboxing that will play at full 800 pixel width in Windows Media Player v6 on an older Toshiba Libretto 110CT notebook with a 233MHz CPU.
Then if anyone has the patience and/or will to explain how those values were arrived at... that'd be superb! :)
Many thanks,
TS
Mr_Odwin
29th March 2006, 12:38
I see that you've been asking about this on the avisynth board and I've been no help for a couple of weeks (real life busy), so I thought I'd describe exactly the process that I went through to get the script above. I'm no expert at this sort of thing and others on this board know more about the technical stuff involved, therefore, I guess some of the stuff I say may be innaccurate, or I may use some technical terms incorrectly.
I'm assuming that you want a mpeg-1 file with a custom display aspect ratio and a 1:1 pixel aspect ratio, made from an original NTSC dvd. I'll also assume you've got the vobs onto your HDD and you can open them in DGIndex.
1) Open up DGindex and one of your vobs. File>Preview and you'll get a window like this:
http://pike.fireflyinternet.co.uk/DGInd1.jpg
You'll get some good information from here. Make a note of whether the aspect ratio is 16:9 or 4:3. The frame size is most likely 720x480 for an NTSC dvd. From the DGIndex manual:
* Honor Pulldown Flags - The pulldown flags (if any) are obeyed and the fields are repeated. This means that the frame-served video will appear exactly as it is intended to appear on the final display device. Therefore, if you have a 3:2 pulled-down clip, you'll get the standard repeating pattern of 3 progressive frames followed by 2 interlaced frames. If you have PAL or MPEG1, you'll just get the encoded pictures with no repeated fields (because PAL and MPEG1 have no RFF flags to honor). The frame rate will always be the same as the display frame rate of the source.
* Ignore Pulldown Flags - The pulldown flags are ignored. This allows one to obtain the raw encoded MPEG pictures, with no repeated fields. However, because repeated fields intended for display are ignored and not displayed, the resulting frame rate may differ from the source frame rate. It may even vary throughout the clip, due to irregular patterns of pulldown flags. If the pulldown is irregular, use of this option will cause the audio-video sync to change at different parts of the clip, and most likely sync will not be acceptable. This option is mostly intended for power users, who would use it as a diagnostic aid for inspecting the encoded MPEG pictures. Although this option ignores the flags, they are still stored in the D2V file although DGDecode will also ignore them.
* Force Film - This option is intended for the special case of film content encoded at 23.976 fps but pulled down for display at 29.97 fps, i.e., 3:2 pulldown. This option will restore the 23.976 fps film rate while keeping audio and video in sync throughout the clip. This option works by ignoring pulldown flags and inserting/removing frames to maintain a constant and sync'ed output stream. Do not use this option on non-3:2 pulled-down material, and, therefore, never use it on PAL or MPEG1.
It is likely that most of your NTSC dvds will be 23.976 content pulled down to display at 29.97 so you'll generallly use the Force Film option. If this produces unexpected results then you may have a non-standard pulldown pattern or the pulldown may be hard-encoded rather then just a flagged. (Often using the decomb package with avisynth can solve these latter problems.)
Anyway, save the project (also choosing the option of demuxing all audio tracks) and you'll end up with a d2v file and some audio files.
If there are several audio tracks then listen to them and decide which one you want to use. Create an avisynth script which is something like the following:
LoadPlugin("C:\Documents and Settings\James\My Documents\FAVC\Avisynth Plugins\DGDecode.dll")
Video=mpeg2source("C:\<clip>\Ap13_clip2.d2v")
Audio=directshowsource("C:\<clip>\Ap13_clip2 T01 3_2ch 448Kbps DELAY 66ms.ac3")
Audiodub(Video,Audio)
DelayAudio(0.066)
Here the DelayAudio parameter (0.066) reflects the delay given in the filename of the chosen audio. Note that you can also use the NicAudio avisynth plugin (http://forum.doom9.org/showthread.php?t=108112) to open the audio portion of your video.
Eg. Use
LoadPlugin("C:\Documents and Settings\James\My Documents\FAVC\Avisynth Plugins\NicAudio.dll")
Audio=NicAC3Source("C:\<clip>\Ap13_clip2 T01 3_2ch 448Kbps DELAY 66ms.ac3")
in the above script for an ac3 source.
2) Now we'll probably need to do some cropping.
Open avisynth your script in Virtualdub or Virtualdubmod. There'll likely be some black borders and we don't really need these.
Go back to your avisynth script and add a line to the end:
Crop(0, 0, -0, -0)
Think of it as crop(left, top, right, bottom) so that each number represents how much you are chopping off each side. (Note this is a slightly different use of crop to that used in the previous posts of this thread)
If there is a black border on the left side of the video then increase the 'left' parameter (eg. crop(2,0,-0,-0)).
If there is a black border on the bottom of the video then increase (well decrease as it's a negative number) the 'bottom' parameter (eg. crop(0,0,-0,-2)).
Each time you increase a number, save it and re-open the script in Virtualdub to check what you've done. Then increase the numbers in the other categories until you are happy with what you see in Virtualdub. Use increments of 2 when changing parameters so that you don't end up with strange artifacts.
3) Now to resize. Your original video was 720 pixels wide and 480 pixels tall, but now you've done some cropping so it's changed. Find the new width and height by opening the script in Virtualdub and using File>File Information. The frame size is the first piece of information given. Or you just do the math.
Eg. Crop(8,60,-8,-60) would result in a new width of 720-8-8=704 and a new height of 480-60-60=360.
Let's call these values NewWidth and NewHeight.
Assuming that you want to resize to a width of 384 there are two cases to follow:
i) Aspect ratio in DGIndex was 4:3
The formula to use is:
ActualAR = (640/720) x (NewWidth/NewHeight)
This is the actual aspect ratio (pixels in dvds aren't square). You have a width of 384, so your height to resize to is given by
Resizeheight = 384/ActualAR
But this may be an odd number and mpeg-1 heights like to be divisible by sixteen so use a Resize height of
RoundedResizeHeight = Round((384/ActualAR)/16) x 16
where Round() means that you round the number off to the nearest whole number. Eg. Round (1.4)=1, Round(1.6)=2, Round(1.5)=2. So, for example, if ActualAR=2.37 then ResizeHeight=162.0253 and RoundedResizeHeight = Round(162.0253/16) x 16 = Round(10.12658) x 16 = 10 x 16 = 160.
Then add the following line to the end of your avisynth script and framserve it to an encoder. In your encoder choose a aspect ratio of 1:1 and all should be well ... hopefully.
Lanczosresize(384, RoundedResizeheight)
(But put the number instead of RoundedResizeHeight.)
ii) Aspect ratio in DGIndex was 16:9
The formula to use is:
ActualAR = (853.333333/720) x (NewWidth/NewHeight)
This is the actual aspect ratio (pixels in dvds aren't square). You have a width of 384, so your height to resize to is given by
Resizeheight = 384/ActualAR
But this may be an odd number and mpeg-1 heights like to be divisible by sixteen so use a Resize height of
RoundedResizeHeight = Round((384/ActualAR)/16) x 16
where Round() means that you round the number off to the nearest whole number. Eg. Round (1.4)=1, Round(1.6)=2, Round(1.5)=2. So, for example, if ActualAR=2.37 then ResizeHeight=162.0253 and RoundedResizeHeight = Round(162.0253/16) x 16 = Round(10.12658) x 16 = 10 x 16 = 160.
Then add the following line to the end of your avisynth script and framserve it to an encoder. In your encoder choose an aspect ratio of 1:1 and all should be well ... hopefully.
Lanczosresize(384, RoundedResizeheight)
(But put the number instead of RoundedResizeHeight.)
Good luck, hope this helps. Anyone else feel free to correct me.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.