Log in

View Full Version : Good MPEG In, Garbage Out


cosmotopper
30th November 2007, 16:02
I have read the newbie posts regarding sound synchronization, and I assume that with enough fiddling around, I could get Avidemux to copy a segment of a larger mpeg without degrading the audio synch. However, I'm mystified as to why it appears (to this newbie at least) that these various tools seem unable to take a properly synchronized input mpeg2 file, and output either a segment, or the whole file for that matter, without disturbing the audio syncronization, even if the output is (apparently) the same as the input.

Whenever I install a new tool, I run a few confidence tests where I try to see if it can perform the simplest operation I can think of, and produce a result which is roughly identical to what I started with. So far, the closest I have come to that is using Avidemux 2.4 GTK, but after chopping out a few segments from a longer mpeg2 original, I'm still seeing a very subtle fade in the audio synch, noticeable only at the syllable level, but noticeable just the same.

I'm wondering if there is something about the MPEG codec which makes it impossible for an editor to read the input and precisely retain the synchronization info. If so, what does it take to minimize the damage?

I've tried a variety of tools to try and deal with this, VirtualDub, MPEG Mediator, and several others over the years. In most cases, all I want to do is extract a few segments of an otherwise perfectly good MPEG2 file without degrading it, and the only program I've found that seems to be able to do this is the Windows Media Encoder, and it is so slow, using it can tie up a machine literally for days.

Thanks to anyone who might be able to shed some light on this.

Guest
30th November 2007, 16:17
Please don't post problems in the FAQ thread. I have moved this for you.

When you demux you lose timestamps, that is why the sync issues arise.

cosmotopper
30th November 2007, 16:50
I don't understand what you're referring to as far as where I posted this, but would appreciate knowing where it was moved to. This appeared to be the forum specifically for AviDemux.

Thanks for the info regards Timestamps, but are you saying that Timestamps are always lost, hence there's no way to use AviDemux for this purpose? If so, any suggestion as to a tool which can do what I'm trying to do?

Thanks for your help.

LoRd_MuldeR
30th November 2007, 16:59
I always use Avidemux to cut parts out of my MPEG-2 captures and it keeps them perfectly in sync! ;)
But Avidemux is not very fault tolerant with improper MPEG streams. So if you loose a/v sync, this indicates a faulty MPEG-2 stream!
Even if the file seems to play fine, you can get unexpected results as soon as you start to edit the file.

Did you try to run your MPEG-2 file through ProjectX before cutting in Avidemux?

This page tries to give hints about editing captured MPEG files. These captured MPEGs are generally from DVB S/T (in MPEG TS format) or from IVTV based cards or any other card with hardware MPEG-2 encoding (in MPEG PS format).

The problem

These captures often contain transmission errors which end up as missing or broken frames. A player (MPlayer, xine, VLC) will constantly resync the streams using the timing information embedded in the stream. Avidemux will not.

Apart from the constant shift, which is easily recoverable using the timeshift filter, it will result in a growing synchronisation issue when encoding or transcoding. Even saving without re-encoding will be async.

MythTV recordings are a prime example of this problem. If the process below is not followed the audio will be offset by approximately -330 ms at the start of the recording and the drift throughout the duration of the recording. Please note that not all MythTV recordings have this problem, just some depending on the software and hardware configuration.

See here for more info:
* http://www.avidemux.org/admWiki/index.php?title=Editing_MPEG_capture_%28DVB_or_IVTV%29
* http://www.avidemux.org/admWiki/index.php?title=Project_X

Guest
30th November 2007, 20:35
I don't understand what you're referring to as far as where I posted this, but would appreciate knowing where it was moved to. This appeared to be the forum specifically for AviDemux. As I said, you posted it at the end of the FAQ thread, and I moved it to its current location in a thread of its own. Is there something difficult to understand about that?

setarip_old
30th November 2007, 21:13
@cosmotopper

Hi!

Try MPEG2Cut.exe

(Say "Woof" to Neal for me ;>})

cosmotopper
30th November 2007, 22:12
If that's where it ended up, I don't know how it got there. I looked through the forum and found the thread referencing AviDemux. Then I clicked on that thread, and found the button that said 'Post Reply', and posted my question. So, since I found my post exactly where I thought it was when I originally posted it, I couldn't quite figure out what you meant when you said you moved it. However, since I've been looking around this forum for a few hours now (and read a few of your responses to other people's questions) I'll leave this tempest in the teapot, and hope you do too.

cosmotopper
30th November 2007, 22:14
@cosmotopper

Hi!

Try MPEG2Cut.exe

(Say "Woof" to Neal for me ;>})

Thanks much, just downloaded it.

cosmotopper
30th November 2007, 22:28
But Avidemux is not very fault tolerant with improper MPEG streams. So if you loose a/v sync, this indicates a faulty MPEG-2 stream!
Even if the file seems to play fine, you can get unexpected results as soon as you start to edit the file.

This MPEG was sent to me by a guy who recorded it off a television broadcast several years ago, so it's entirely possible that there's a problem with the stream. I will get ProjectX and check it out. BTW, just downloaded several of your very useful tools. FYI, your 'obsolete' Mencoder.264 transcoded an MP4S stream I made with a Plextor encoder perfectly, after the latest version of MeGUI couldn't do it (couldn't find MP4S, even though it's alive an well on the machine I was using). So thanks for both!

LoRd_MuldeR
1st December 2007, 00:04
If that's where it ended up, I don't know how it got there. I looked through the forum and found the thread referencing AviDemux. Then I clicked on that thread, and found the button that said 'Post Reply', and posted my question. So, since I found my post exactly where I thought it was when I originally posted it, I couldn't quite figure out what you meant when you said you moved it. However, since I've been looking around this forum for a few hours now (and read a few of your responses to other people's questions) I'll leave this tempest in the teapot, and hope you do too.
Look, we have a whole Sub-Forum dedicated to VirtualDub & Avidemux:
http://forum.doom9.org/forumdisplay.php?f=22

You can feel free to create a new thread there, if you have a new Avidemux-related topic you want to discuss :)
Simply use the "New Thread" button below and choose a good title for your new thread (not "HELP !!!!!!!" or alike!)
Only reply to an existing thread, if that thread addresses your specific topic. Off-topic posts are evil ;)

Last time you replied to the sticky "FAQ" thread.
The sticky threads (the ones above the normal ones) are for special/important topics, not for miscellaneous discussion.
Only moderators can create stickies, regular users usually don't replay to stickies...


This MPEG was sent to me by a guy who recorded it off a television broadcast several years ago, so it's entirely possible that there's a problem with the stream.
There you have the origin of your problem :D
Good luck fixing it with ProjectX...

But please be careful with the Forum rules, especially rule #6:
6) No warez, cracks, serials or illegally obtained copyrighted content! Links to content of a questionable nature, asking for, offering, or asking for help/helping to process such content in any way or form is not tolerated.

setarip_old
1st December 2007, 07:40
@cosmotopperThis MPEG was sent to me by a guy who recorded it off a television broadcast several years ago, so it's entirely possible that there's a problem with the stream.This statement casts an entirely different light on your problem..

Your initial post made it sound like you had determined that NO tool could properly cut ANY MPEG.

Now it seems that you're referring to ONE file - and you weren't even its creator!

This makes it well nigh impossible for anyone to provide you with meaningful assistance due to both your lack of knowledge regarding how it was created and the forum rules, as already pointed out by "Lord_Mulder"...

cosmotopper
1st December 2007, 22:27
...It seems the two coexist quite comfortably on the Internet.

I've been observing and periodically trying out various open-source video editing software apps over a period of 10 years, and it has only been in the last year or so that they appear to have evolved to a point where they can be used effectively for relatively simple purposes by non-technically oriented folks. However, during that time, the one flaw that has turned up most frequently (in my experience at least) is failure to properly replicate the audio synchronization. This is true not only of the open source packages, but I've seen it with Intervideo & Nero & Roxio. Since most of what I do starts as an mpeg2, and I know enough about how mpeg2 works to know that there are lots of variables involved in the audio synchronization, my question was intended to get a basic reality check as to whether or not my experience was typical, or indicative of a specific procedural issue that I might have overlooked.

Yes, the particular file I was working with originated somewhere else. So what? It may have been improperly coded. I would expect the software to detect that when loading the file. For example, when I loaded an .AVI transcoded by Mencoder from an original .FLV file, AviDemux kicked back a warning message concerning H264 warning of possible consequences:

If the file is using bframe as reference, it can lead to crash or stutteting.
Avidemux can use another mode which is safed but YOU WILL LOOSE FRAME ACCURACY.
Do you want to use that mode ?

Outstanding. Seems to me if there's a potential problem with the audio, that should be detected as well. But given that it's open-source, we don't complain about those things. But I do think it's entirely appropriate to ask a generic question from those who have experience with the tools as to whether the problem I encountered was relatively common, or highly unusual.

Based on my experience, when the audio is out of sync, you know it. In this case, the synchronization was 'almost perfect', to the point where I think maybe 99% of those viewing and listening wouldn't even have noticed it. If I were maintaining the code, it's something I would take time out to look at very carefully, because I'm not sure how one could make it do that on purpose.

In any case, I got two clues from two respondents: 'timestamps' and 'mpeg streams may play okay, but still have defects within' (words to that effect). Those were both helpful.

As for posting my question in the FAQ thread, it's not something I would do on purpose. Perhaps I hit a back button once too often, but I thought I was in the right forum when I posted my question. But I thought it was interesting that I encountered the 'please genuflect before speaking to me...' response from 3 different people, particularly given the emphasis on 'being nice to each other' which is mentioned in the rules. I thought that was a great thing to emphasize, too bad the high-priests here don't feel compelled to follow that rule.

In a day or so, I've found a ton of useful information in this forum, but also a good measure of the 'attitude' which seems to be endemic to technically erudite individuals who live most of their lives on-line. Next time I summon the temerity to ask a question, I'll try to be more careful.

Guest
1st December 2007, 22:51
As for posting my question in the FAQ thread, it's not something I would do on purpose. You said you wanted to leave that in the teapot. Why are you bringing it up again?

Your attitude is not doing you any good here. You may want to adjust it if you want to have a long productive stay here.

As for the shortcomings of open source software, why don't you learn to code and contribute something besides whiny insults? You might find out that things are not as simple as you suppose.

Jay Bee
3rd December 2007, 00:30
In my experience VideoRedo is the best when it comes to keeping MPEG in synch. Try running your file through its quick stream fix before loading it in Avidemux. Or just use it to do the cutting if you want to keep it as MPEG anyway.

Jay Bee
3rd December 2007, 00:39
As for the shortcomings of open source software, why don't you learn to code and contribute something besides whiny insults? You might find out that things are not as simple as you suppose.

Yeah, that's the sort of response that gives OOS its good name...

Guest
3rd December 2007, 02:58
What do you mean, Jay Bee? I missed your point.

Jay Bee
3rd December 2007, 03:24
The guy was just giving his feedback on software he was trying to use and I didn't see any impoliteness on his side. Normally a software developer would be either thankful for feedback, offer help, discuss the questions asked, disagree with him or maybe just ignore him.

Instead the OP gets attacked and called a whiner. Usually it's open source devs (and fanboys) that behave in this manner. That was my point.

Guest
3rd December 2007, 03:58
I see. OK, struck for your off-topic post.

Jay Bee
5th December 2007, 05:22
For off topic, eh? Maybe you need to introduce a "mods must not be criticized" rule, then my strike would at least make sense.