PDA

View Full Version : fixing my .mp2 mistake...help please


vertigo_phreeze
10th October 2003, 04:53
ok, like i have see that several others have done, i made the mistake of capturing some files with ATI's MultiMedia Center in their MPEG 2 format (.mp2). after searching around i have found a way to demux and end up with usable files (video and audio seperate). i am about to convert the video parts, which are now .m2v, to .avi so i can remerge them in VirtualDub. i want them to remain at 640x480, but other than that, what settings do you recommend for encoding these to Divx. these are things like clips from t.v. and stuff, so i just want them to look decent, they dont have to be DVD quality or anything (using newest version of Divx 5 Pro). thanks for the help guys.

Erik_Osterholm
10th October 2003, 06:20
Not sure if your problem is that the audio is nonstandard or what precisely, but there's tons of information on encoding in the guides and forums. A few points:

I'd use AVISynth to do de-interlacing (if needed). You can use BeSweet to convert the audio, if that's being problematic. Other than that, I think you'll need to be more specific with your problems/concerns to get any useful help.

theeht
10th October 2003, 07:09
Originally posted by vertigo_phreeze
ok, like i have see that several others have done, i made the mistake of capturing some files with ATI's MultiMedia Center in their MPEG 2 format (.mp2).
I don't know why ATI calls it mp2, but it is simply an mpeg file. If you change the extension to .mpg it behaves exactly as an mpeg file should, and you can demux it in Tmpgenc even without renaming it (though you'll have to change the default name for the demuxed audio file). I wonder why you want it in Divx when you already have mpeg-2--to decrease file size? In any case, for good Divx results I'd look into GordianKnot, it's a relatively simple, semi-automated way to get this done.

vertigo_phreeze
10th October 2003, 08:47
ok, the files arent really a problem anymore. i was curious about you guys advice on the coversion to Dixv at a good setting. i demuxed in Tmpgenc wich made the video a .m2v file, converted the .mpa to .wav with BeSweet, and now i am gonna convert the video to .avi for VirtualDub (so i could remerge into one file and edit out commercials and stuff) and i wanted advice on that. the video has not been compressed anymore than whatever it was during the original capture and so in the conversion to Divx, i want to keep as much quality as i have right now as long as it doesnt go overboard on size. this is a one time thing, i just wanted to make these files either useable or storage friendly and in the future i will capture in a format i can work with. thanks for the help.

Erik_Osterholm
10th October 2003, 08:59
Ah! Then I'd definately use AVISynth (personal preference) to trim out the commercials. It saves you from making that intermediate HUGE avi file. It is, perhaps, a slightly complicated process to learn, but once you get it down, it will provide the best quality.

Open up the m2v in DVD2AVI, make sure there are no field order changes, and save the project to create a d2v file.

Create an AVISynth script, loading the d2v file (you'll need the mpeg2dec3 plugin for this), give it the names of your video and audio files, and combine them. It's going to look something like this:

LoadPlugin("c:\plugins\mpeg2dec3.dll")
video = mpeg2source("c:\captures\mycapture.d2v")
audio = wavsource("c:\captures\mycapture.wav")
output = audiodub(video,audio)


Now that all that's out of the way, you can begin trimming the commercials out. You can use VirtualDub to find the frame breakpoints and whatnot, and do it like this:

output = output.trim(startframe,endframe) + output.trim(startframe2,endframe2) + ..... etc

When you've done that, your avs file will act like a raw AVI (while taking up no more space than the original files) and you can treat it as such, encoding in Virtualdub, TMPGEnc, whatever. MAKE SURE YOU DON'T DELETE THE ORIGINAL MPEG STREAMS UNTIL YOU ARE DONE! (sorry, just didn't want this to happen accidentally)

When you get comfortable with this process, you can begin using other filters. Resizing, blurring, deinterlacing (may be important for you to learn this one early, if you're using > 240/288 vertical resolution) etc. can all be done in AVISynth very well.

vertigo_phreeze
10th October 2003, 10:13
i dont know what it is that you said, but i have read through like 4 different tutorials on AviSynth and just ended up more confused. that made sense to me for some reason, and i just saved that post so i dont loose it. thanks a lot. i will give that a try when i get home from work in the morning.

vertigo_phreeze
15th October 2003, 10:52
i keep having the same problem opening the .avs files in Virtual Dub. i have followed a couple different guides on using AVISynth (all the way down to starting from scratch and reinstalling them) and went step by step...but when i try to open the .avs file in Virtual Dub it says there was an "error reading line 2".

i have, however, been able to do do my trimming in the same basic style of Vdub within TMPGEnc and it was much quicker and retains the same quality. i also havent had any synch problems. i am still gonna have to convert these to .avi, but i think this will save me a lot of time since the editing is so much faster than in Vdub.

if you have any other suggestions or if you have any ideas as to how i can get AVISynth to work for me, they are more than welcome, i am excited about learning to do some of this stuff you guys are talking about.

Erik_Osterholm
15th October 2003, 11:02
You'd have to post your whole AVISynth script so we know what line 2 is (or did you just use what I wrote above?) If you are able to edit in tmpgenc, that's fine, but I know that sometimes ATI MMC doesn't insert an I-Frame at the commercial break, meaning you'll either lose a few frames of TV show or you'll get 1-10 frames of commercial in your final video, which is why I went the AVISynth route myself.

vertigo_phreeze
18th October 2003, 12:39
i did just copy and paste what you wrote for the AVISynth script, and just to make sure i had the location exactly correct, i right-clicked the file and went to "creat shortcut" and cut and pasted the location directly out of there. i have tried opening the .avs file in both the newest version of Virtual Dub and the version of Virtual Dub Mod that was packaged with the Gordian Knot Rip Pack and got the same error message with both.

In Virtual Dub Mod, i can open the .m2V file type and .wav i got from demuxing. will Virtual Dub allow for more precise editing so i can get those loose frames at the beginning and end of the commercial break? i still plan to convert to DIVX, and i dont mind doing a bit more precise trimming, but the initial editing was much faster in tmpgenc.

also, what are these "I-Frames" you were speaking of and how would i go about working with them (if not on this stuff, on future captures)?

Erik_Osterholm
18th October 2003, 15:59
Go ahead and post (or private message me) your script. Error in reading line 2 is a pretty vague error, and one I don't recall seeing anyway.

I'm not near my own computer, but I suspect that VirtualDubMod will let you do the more precise edits. Just try and see :) If it doesn't, we can try to see what's up with your script a bit more.

As for what I-frames are....

It's a much, much longer discussion than you probably want, but basically when you encode an mpeg-2 video stream, there are three types of frames you may use: I, P and B. Very simply put, if you have two raw frames and you want to save them both to your computer, you have to save the first one mostly as is--you can compress it somewhat, but you have to store it like a picture. The second image, however, is quite likely to be very similar to the first (you can see this for yourself in VDubMod, just step through frames. Most frames are similar to the ones before and after it.) As such, you can just store the difference between the first and second raw frames. When it comes time to decode, you first look at the first frame, then to get the second frame, you just add back in the changes. The second frame takes a lot less room to store, but it is dependant upon the first frame. If you lose the first frame, the second frame is garbage and makes no sense.

In the above example, I-frames are like the first frame--a whole picture. P-frames are like the second picture--they just store the difference between the first picture and the actual frame, and are thus dependant upon the first picture in order to be decoded. B-frames are similarly dependant upon other frames, but they are more complex and I won't get into that.

So if your mpeg looks like this:

IPPBPPB IPPBPPB IPPBPPB

What happens if you want to cut out a commercial and your show begins again on the fourth frame of the set? Your cut would look like this:

BPPB IPPBPPB IPPBPPB

However as I said, without the preceding I-frame, all you have is garbage. Your choice, then, is to either lose a bit of your show but cutting out the entire first group of pictures (GOP) or to have a small bit of commercial tacked on there.

AVISynth and similar utilities recreate the entire raw stream so you can recompress it using the codec of your choice, but if you want to cut your stream without recompressing, you have to cut on an I-frame boundary (and MAYBE you can cut after a P-frame, but I'm not sure--it's early for me, and I'm not thinking perfectly clearly :)


Anyway, that's probably more than you wanted to know, but it does give you an explanation of why you can't cut perfectly in an mpeg stream, and why I prefer to use AVISynth.

vertigo_phreeze
19th October 2003, 02:40
ok, i am sure there is a lot more to know on the subject, but that made sense. i had seen those letters before and never knew what they were. i am at work, so i will have to wait till i get home in the morning and i will get the exact script and exact error message and let you check them out. once again, thanks for all your help.

vertigo_phreeze
23rd October 2003, 01:13
ok, here is my .avs script:

LoadPlugin("C:\Program Files\Gordian Knot\MPEG2Dec3.dll")
video = mpeg2source("C:\My Documents\Video\SNL - Punked.m2v")
audio = wavsource("C:\My Documents\Video\SNL - Punked.wav")
output = audiodub(video,audio)

and here was the error message in Virtual Dub:

Avisynth open failure:
MPEG2Source: couldn't open file
(C:\My Documents\Video\SNL - Punked.avs, line 2)

i also tried making the ".m2v" file a DVD2AVI project file (.d2v), and here is my script:

LoadPlugin("C:\Program Files\Gordian Knot\MPEG2Dec3.dll")
video = mpeg2source("C:\My Documents\Video\SNL - Punked.d2v")
audio = wavsource("C:\My Documents\Video\SNL - Punked.wav")
output = audiodub(video,audio)

and the error from trying it that way:

Avisynth open failure:
the script's return was not a video clip


also, i noticed that in capturing with the ATI Multimedia Center i could control the number of "B" and "P" frames created or have it captured in all "I" frames...should i leave it at the default or should i change those settings.

Erik_Osterholm
23rd October 2003, 02:48
Well for starters, it does have to be a d2v file, so that's the first issue. It seems that I neglected to put a return statement in my script, so that's the other problem. Just put "return (output)" (without the quotes) as the last line in your script. Then it should work just fine, again, using the d2v file.

As for the frame types in ATI MMC, I wouldn't change them. I-frame only is ok for easy editing and reencoding later, but remember that I-frames take more space, so your quality will be just a touch lower (or your filesize will be higher).

vertigo_phreeze
23rd October 2003, 03:54
is this right?

LoadPlugin("C:\Program Files\Gordian Knot\MPEG2Dec3.dll")
video = mpeg2source("C:\My Documents\Video\SNL - Punked.d2v")
audio = wavsource("C:\My Documents\Video\SNL - Punked.wav")
output = audiodub(video,audio)
return (output)

i will try that when i get home. i still have the .avs file, so if this is correct then i will just cut and paste this new script.

also, would the file size be a lot higher for going all "I" frames, or would the quality loss be very noticeable? i dont mind if the quality isnt the greatest ever, these are mostly stuff like clips from t.v. shows or shows that probably wont make it to DVD for a while or ever. they would be sort of like temporary copies for watching every now and then or sharing with friends. if the "I" frames will make the editing and encoding fater, then i wouldnt be against using that and just compressing when i am done.

Erik_Osterholm
23rd October 2003, 04:08
That script looks ok. As for the I-frame issue, just play with it and use your own judgement. See what bitrates give you acceptable quality, if your computer can capture that high a bitrate, etc, and don't just judge it by the mpeg-2, try converting video both ways and see what looks best. If the artifacting/quality is acceptable, just use I-frames.

I guess it boils down to this: your computer has some theorhetical maximum bitrate it can capture to, limited partially by your CPU and partially by how fast you can plop data onto the hard disk. At this theorhetical maximum bitrate, quality will be better with P- and B-frames. Only you can determine whether the quality hit is worthwhile, or even noticeable, to yourself. Best of luck, and let us know what you decide :)

Mug Funky
24th October 2003, 17:09
capturing all in I frames is fine so long as you have a lot of disk space. they actually take less CPU time then p and b frames, but seeing as it's most probably hardware MPEG-2 compression, there won't be any difference.

as for cutting, yeah, you can only cut on i and p frames.

a b-frame is pretty much the same as a p-frame, but it's most notable difference it is stores the difference between itself and the previous and last P or I frame.

this means they have 2 dependent frames, that can be in the future as well as the past.

but editing isn't too bad. cuts to commercials usually consist of a fade to black. you're not going to be stressing over single-frame precision in this case. just cut on a p frame.

avisynth is definitely something to get into if you're doing divx'ing and the like because it can work magic on footage that even professional editing suites can't match (deinterlacing in premiere? AARGH!). for live captures, you might for instance want to decrease the white noise and snow, or get rid of colour crosstalk (to an extent). avisynth can do all this stuff. also, a smooth video compresses better than a grainy one, so your videos will look better and have smaller file sizes.

Erik_Osterholm
24th October 2003, 20:57
I've seen some DVD players that did funky things when hit with a stream of all I-frames. I think they should be able to handle it, but frequently they can't. While responding to this thread, in the back of my mind, I was always thinking "DVD" even though clearly vertigo_phreeze said that he was going to DivX.

I didn't get into B-frames because I've found that for relative novices, it's harder to understand. People will be right with me up until I mention "dependant upon the last and next frame" and then they sort of zone out ;)

As for cutting on a P frame, it won't help if the frame depends upon an I-frame that's in the commercial (for example, the bit of the program after a commercial break.) There usually /is/ a fade-in, but nto always. TNT/TBS are pretty bad about this, and my local network affiliates frequently just jump right into the program (though they fade out when going to commercials). That can make it difficult.

So about this colour crosstalk..what plugins do you use to help take care of this? It's actually something I've been intending to look into for awhile :)