What am I doing wrong with 2-pass XviD encoding?

Moderator: Ken Berry

Post Reply
nb51
Posts: 23
Joined: Sun Dec 10, 2006 11:05 am

What am I doing wrong with 2-pass XviD encoding?

Post by nb51 »

I've used two-pass XviD encoding in several different tools with no real problems, but something's not working right when I try it in VideoStudio 10.

First, I set the XviD codec settings for 1'st pass, then save the file to an avi container named, for example, <name>pass1.avi. I do this because I'm assuming the stats needed for the 2'nd pass are stored there. (Is this correct?)

Then, once the 1'st pass rendering is complete, I change the XviD codec for 2'nd pass, then save the file to an avi container named <name>pass2.avi. I do this because I'm assuming the original file (<name>pass1.avi) shouldn't be over-written because it is the source of the stats created in the 1'st pass.

HOWEVER, when I do this, BOTH <name>pass1.avi AND <name>pass2.avi are small files (too small) that not only do not play, they cause WinDVD to crash each and every time! And even the VLC player can't play them right.

So it looks like I must be doing something wrong. What is it? Any ideas?

(Oh, and by the way, I will NOT use DivX! It is proprietary and not ideal for any platform but Windows. It's XviD, which is open and cross-platform, or it's nothing.)

Thanks!
sjj1805
Posts: 14383
Joined: Wed Jan 26, 2005 7:20 am
operating_system: Windows XP Pro
System_Drive: C
32bit or 64bit: 32 Bit
motherboard: Equium P200-178
processor: Intel Pentium Dual-Core Processor T2080
ram: 2 GB
Video Card: Intel 945 Express
sound_card: Intel GMA 950
Hard_Drive_Capacity: 1160 GB
Location: Birmingham UK

Post by sjj1805 »

nb51
Posts: 23
Joined: Sun Dec 10, 2006 11:05 am

Post by nb51 »

Thank you, but as I said, I have ZERO interest in using DivX! Ain't gonna happen, for reasons I specified in my OP. Too much bad press and complaints, too.

And what you pointed me to did not have any real applicability to my question, unfortunately.

Anyone else want to try?
nb51
Posts: 23
Joined: Sun Dec 10, 2006 11:05 am

Additional Puzzling Evidence

Post by nb51 »

This is pretty weird! As I said, I've tried to run the 2'nd pass in XviD codec from within VS10 several times now without success. But just for the hell of it, I tried just running the 2'nd pass about 6 times in a row for a single 1'st pass file, and at the 6'th time, it worked -- perfectly!

So now my question becomes: How come it didn't work the first FIVE times? Do I really have to run the 2'nd pass 6 times in a row, or is there a bug of some sort?
nb51
Posts: 23
Joined: Sun Dec 10, 2006 11:05 am

Further Puzzling Info

Post by nb51 »

Okay, even assuming I have to do the 2'nd pass several times, I still have a big and strange problem. When I play files I've processed since my initial success, the first 60-180 seconds plays only the audio (after which the video suddenly appears and remains fine for the rest of the file).

So I went back in and tried the 2'nd pass yet again, and even as it was being rendered, the internal display revealed audio only for the first 60-180 seconds (or so), just like when I played them externally. So then I re-ran the 1'st pass again, and this, too, only had audio for that first minute or three!

Now, there are no cuts or other edits in what I'm trying to render, so there is no significance I can see to the time period in question with audio only. Here is exactly my procedure for importing one scene from a DVD and saving out to a local .avi file (NOT back to DVD) using the XviD MPEG4 codec in two passes:
  • 1) Launched VideoStudio. (I've set the option NOT to open with previous project, so it automatically creates a new project, which is what I want).
  • 2) Imported just one scene from a set of DVD VOB files on disk (using the "Insert Media File to Timeline" feature, then using the "Insert DVD/DVD-VR..." pop-up and then check-marking only the scene that I want). There is no copy protection on this DVD.
  • 3) Switched to Edit Tab and only added auto-level video filter (the original is too dark).
  • 4) Switched to Share Tab and selected "Create Video File", then selected "Custom" at the bottom of the pop-up menu.
  • 5) Changed "Save as type:" to "Microsoft AVI files", and entered my first pass filename (scene4pass1.avi).
  • 6) Pressed the "Options" button, and did the following for the three tabs it brought up:
  • 6a) On "Ulead VideoStudio" tab, chose the "Entire project" radio button, disabled "Play file after creating it", enabled "Perform SmartRender", enabled "Perform non-square pixel rendering, and disabled "Create video file with specified duration".
  • 6b) On the "General" tab, I set "Data track" to "Audio and Video", Frame rate to "29.97", Frame type to "Lower Field First", and "Frame size" to "Standard 720x480".
  • 6c1) On the "AVI" tab, I selected "XviD MPEG-4 Codec", then skipped for now to the Audio section, where I chose Format: "MPEG Audio Layer3" and Attributes: "44100 Hz, 118 kbps ABR, Stereo" (the sound quality doesn't need to be that great).
  • 6c2) I then pressed the "Configure..." button, set the "Profile @ Level" at "Advanced Simple @ L5", and set "Encoding type" to "Twopass - 1st pass". I made sure that the Quality Preset was set to "General purpose" and left everything else alone (i.e., only one zone starting at frame 0 with weight 1.00). Then I "Okay"ed out back to the "Create Video File" pop-up, then pressed "Save".
  • 7) The "Rendering" thing came up, but no video showed on the display area until the Rendering progress bar showed about "11% completed". The first video frame to show on the display was about 2 to 3 MINUTES into the DVD scene!
  • 8 ) (That's supposed to be an "8", not a smiley) -- When the first pass was complete, I went back to Step 4 above, only this time in step 6c2 I changed the filename to "scene4pass2.avi" and used the "Configure" button to set the "Encoding type" to "Twopass - 2nd pass", set the target bitrate at 4000 (I want very good, but not great, quality). After which I pressed "Save" again.
  • 9) [For several times in a row, NO video AT ALL showed up on the display during the entire rendering process, which I now know means the output file will be unplayable. So I repeated this step 4 or 5 more times until, at step 10...]
  • 10) I saw the exact same thing I saw during the first pass: No video on the display until about 11% complete! The resulting output video file played without an error message, but there was audio only for 1-3 minutes, as you'd unfortunately expect given the above. Only a bit later did both audio and video display then continue fine.
Okay, sorry about all the verbiage, but I wanted to make it crystal clear exactly what I was doing in case I messed up one or more steps.

So: What on earth is going on here?? :?:
nb51
Posts: 23
Joined: Sun Dec 10, 2006 11:05 am

Re: Further Puzzling Info - clarification/revision

Post by nb51 »

Revision of Step 2. I had written:
2) Imported just one scene from a set of DVD VOB files on disk (using the "Insert Media File to Timeline" feature, then using the "Insert DVD/DVD-VR..." pop-up and then check-marking only the scene that I want). There is no copy protection on this DVD.
That's not actually what I did. In reality, I read the data from the DVD itself, rather than using on-disk VOB files as I indicated.
nb51
Posts: 23
Joined: Sun Dec 10, 2006 11:05 am

GSpot displays relevant to the above

Post by nb51 »

I hope these will help. They're 5 Gspot displays showing encoding and error information for the XviD pass2 output file I keep getting that has audio only for the first minute. Here's what happens when I try to play it in my various media player software:

VLC media player: It plays the whole thing fine without an error message (but still lacks the first minute of video).

WinDVD: Crashes immediately.

PowerDVD: Briefly brings up a green, emtpy screen for about 1 second, then gives up (but doesn't crash or issue an error message).

Windows Media Player: Blank window, no audio, no video.


Anyway, here are the images:

First is the Gspot display with the "Vid 1" button pressed:
Image

Second is with the "Vid 2" button pressed:
Image

Next is with the "Aud 1" button:
Image

Now "Aud 2":
Image

Finally, with the "MS A/V 1" button pressed:
Image


Now, I must report that the very same kind of thing happened when I switched entirely to the DivX 6 codec! So it just doesn't seem to matter whether I use XviD or DivX.


Please, please, can someone help me out?
htchien
Advisor
Posts: 2013
Joined: Sat Dec 11, 2004 12:10 pm
operating_system: Mac
System_Drive: C
32bit or 64bit: 64 Bit
Location: Taipei, Taiwan
Contact:

Post by htchien »

After you change the encoding profile to 2-pass, try to restart UVS and then see if the 2-pass encoding works.

H.T.
Ted (H.T.)

[color=red]The message is provided AS IS with no warranties and confers no rights. For official tech support please contact Corel Tech Support.[/color]

[url=http://www.youtube.com/htchien]My YouTube channel[/url]
jchunter

Post by jchunter »

NB,
I have only transcoded mpeg2 HDV (1440x1080) Interlaced to Xvid 1920x1080 deinterlaced Frame-Based and the (single-pass) results were excellent, showing no measurable loss of resolution. I was pleased with the picture quality and therefore was not motivated to try multi-pass.

Have you succeeded in doing single-pass Xvid? If so, how did the picture quality compare to the original? You are only working with 720x480 video, so why the push to multi-pass?

For debugging multi-pass, I would start by omitting your step 3, which adds a globally acting filter to your captured mpeg2. This may complicate the transcoding. Try omitting this step so that the Xvid codec only transcodes from Mpeg2 to Xvid.

Also, make sure that every video property matches that of the original capture file. The one exception may be the field order, which may have to be set to Frame-Based for Xvid. However, the following thread sheds some light on interlaced Xvid http://forum.doom9.org/archive/index.php/t-98878.html

Also, here is a link to the Xvid Forum: http://forum.xvid.org/index.php?sid=2d7 ... 7d14ece0a8
nb51
Posts: 23
Joined: Sun Dec 10, 2006 11:05 am

Post by nb51 »

htchien wrote:After you change the encoding profile to 2-pass, try to restart UVS and then see if the 2-pass encoding works.

H.T.
Thank you for the suggestion. I appreciate your response!

I tried your suggestion, and, lo and behold, it often works! I'm guessing there's some kind of internal state that gets messed up that's cleared by exiting in between passes -- undeniably a real bug. (Recall that it fails the exact same way whether I use XviD or DivX).

However, even then it doesn't work every time. I still have to repeat the second pass several times before it'll work. That's another bug, it seems to me.

Thank you again. If you have any further suggestions, I would be most grateful for them!

(Oh, and if you have any ideas about this topic, I'ld love to hear them, too.)
nb51
Posts: 23
Joined: Sun Dec 10, 2006 11:05 am

Post by nb51 »

jchunter wrote:NB,
I have only transcoded mpeg2 HDV (1440x1080) Interlaced to Xvid 1920x1080 deinterlaced Frame-Based and the (single-pass) results were excellent, showing no measurable loss of resolution. I was pleased with the picture quality and therefore was not motivated to try multi-pass.

Have you succeeded in doing single-pass Xvid? If so, how did the picture quality compare to the original? You are only working with 720x480 video, so why the push to multi-pass?
First, let me thank you for your response!

Alas, my eyesight isn't what it used to be and I, myself, can't realibly discern visual quality issues. However, when I have used single pass, I got complaints about low-ish quality and people have directly asked me to use two passes. And this has come from more than one source.

Not being able to see clearly enough to reject such requests, it seemed a simple thing to do, especially now with faster 1'st passes and much faster processors. And these people do somehow recognize that I had been using one pass only (I didn't tell them), and they approve of videos that they somehow think (I don't know why or how) underwent two passes. So I'd like to keep trying.
jchunter wrote:For debugging multi-pass, I would start by omitting your step 3, which adds a globally acting filter to your captured mpeg2. This may complicate the transcoding. Try omitting this step so that the Xvid codec only transcodes from Mpeg2 to Xvid.
Thanks for the idea. I did try it, but I'm afraid it made no difference in any of the several symptoms I described above. (As an aside, I've since discovered that the pink "error" lines in some of the Gspot displays above were seen in every other video I tried Gspot on, including the raw DVD and all kinds of other vids I had nothing to do with.)
jchunter wrote:Also, make sure that every video property matches that of the original capture file.
I'm afraid I'm too green to know exactly what you're referring to. When I insert a video file (in this case, directly from the DVD (not capture), I answer "yes" to the pop-up that asks if I want to change the project to match the source. However, don't I need to change at least some of the video properties during the sharing/encoding process, i.e, changing it from MPEG-2 to XviD/DivX? Or was that last a dumb question, and that step is not at all what you're referring to?
jchunter wrote:The one exception may be the field order, which may have to be set to Frame-Based for Xvid. However, the following thread sheds some light on interlaced Xvid http://forum.doom9.org/archive/index.php/t-98878.html
Thanks again for the pointer. Although I didn't quite grasp where in that discussion someone explicitly suggested that, it seemed to make intuitive sense (since I didn't know what the actual field order was) to use that advanced setting, so I've done so all along.
jchunter wrote:Also, here is a link to the Xvid Forum: http://forum.xvid.org/index.php?sid=2d7 ... 7d14ece0a8
Thanks again.

And since you seem so knowledgeable, do you think you could spend a moment reviewing this audio question of mine? TIA!
User avatar
Ken Berry
Site Admin
Posts: 22481
Joined: Fri Dec 10, 2004 9:36 pm
operating_system: Windows 11
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte B550M DS3H AC
processor: AMD Ryzen 9 5900X
ram: 32 GB DDR4
Video Card: AMD RX 6600 XT
Hard_Drive_Capacity: 1 TB SSD + 2 TB HDD
Monitor/Display Make & Model: Kogan 32" 4K 3840 x 2160
Corel programs: VS2022; PSP2023; DRAW2021; Painter 2022
Location: Levin, New Zealand

Post by Ken Berry »

I know you are not interested in DivX, and in reverse, I have never played around with XVid and so cannot comment directly. Moreover, I do not know what the settings within XVid might be, let alone whether they are similar to those in DivX

However, if they are, then you might find the following of interest, since I have played around with high quality settings in DivX.

I too was unhappy with single pass settings. So I ended up trying the DivX 'multipass Nth pass' at 3000 kbps bitrate and using the Balanced (default) encoding setting. This rendered faster than real time and produced an extremely good quality mpeg-4 file of around 178 MB in size for about 5 minutes 30 seconds of video. No blurring or stippling.

Just to say I tested all settings, I also decided to use the final quality setting in DivX Home Theatre mode -- '1 pass quality mode'. This took away the bitrate setting and substituted a 'Target Quantizer' set at 4. It was also set to use Balanced default encoding mode. Rendering took 5 minutes 50 seconds (slightly more than real time) and produced a file of 184 MB -- the largest, but noticeably the best in quality (though not much more so than that produced with multipass Nth pass at 3000 kbps). I played this file on WMP and PowerDVD, as well as the original DVD-compatible mpeg-2 of the same video, and I had a hard time telling any significant differences in quality on my 19 inch CRT computer screen.

These file sizes might be much too large for you -- I don't know. But for me they were excellent. You should note, however, that I was working in SD as I have not yet ventured into HD.

My system details you can find in my System button below.
Ken Berry
htchien
Advisor
Posts: 2013
Joined: Sat Dec 11, 2004 12:10 pm
operating_system: Mac
System_Drive: C
32bit or 64bit: 64 Bit
Location: Taipei, Taiwan
Contact:

Post by htchien »

Hi,
nb51 wrote:
htchien wrote:After you change the encoding profile to 2-pass, try to restart UVS and then see if the 2-pass encoding works.

H.T.
Thank you for the suggestion. I appreciate your response!

I tried your suggestion, and, lo and behold, it often works! I'm guessing there's some kind of internal state that gets messed up that's cleared by exiting in between passes -- undeniably a real bug. (Recall that it fails the exact same way whether I use XviD or DivX).

However, even then it doesn't work every time. I still have to repeat the second pass several times before it'll work. That's another bug, it seems to me.
For DivX / XviD mulit-pass encoding, you need to restart UVS after you changed the profile to multi-pass. It's not a bug due to some limitations.

H.T.
Ted (H.T.)

[color=red]The message is provided AS IS with no warranties and confers no rights. For official tech support please contact Corel Tech Support.[/color]

[url=http://www.youtube.com/htchien]My YouTube channel[/url]
maddrummer3301
Posts: 2507
Joined: Fri Dec 10, 2004 10:24 pm
Location: US

Post by maddrummer3301 »

.
Post Reply