SamsonovAnton
22nd September 2010, 14:32
I'm not sure whether this forum section is appropriate for my question, because I'm not encoding MPEG2, but only chopping video fragments without re-encoding.
The source of my materials is a digital camcorder which outputs MPEG-PS files, with .mod extension, containing MPEG2 video (SD, 4.5 Mbit/s) and AC3 audio (stereo, 256 kbit/s). When I simply play these files with any software, everything is fine. When I crop them in time domain, using AviDemux and the same output format, everything is still fine. Well, I notice a small difference of reported duration, depending on player software, but this is negligible — only a couple of seconds for a 10-minute video.
But I run into a huge difference when trying to remove original audio: resulting files are reported to be approximately half-length (about 40–60 % of real duration), and are not seekable, or disrupt the sound after seeking.
My first method was to replace the audio track with a pre-generated quiet noise, also AC3-encoded (with FFmpeg). I accomplished this by means of AviDemux's standard function. When playing, SMplayer and VLC report bad duration, confuse at seeking and stop audio after seeking. (I also found that SMplayer isn't able to seek through AC3 soundtrack in a separate file, whether it's an original track or a substituted one.) However, in Media Player Classic and Windows Media Player those video files seem to play well.
My second approach was to use Mencoder instead of AviDemux. The resulting files opened fine at least in SMPlayer, but it was not too long before I discovered that the output format that Mencoder automatically switched to (with some files only, but not with other, which is very strange), was AVI. Because I heard that putting MPEG streams inside AVI container is a bad manner, I forced the format to be MPEG-PS. It produced the most strange files, which SMplayer tried to play at 10x speed without sound.
Then I deciced to get just a raw MPEG video stream. Both AviDemux and Mencoder produce the same result, which have the same problems as the first method: bad reported length, glitchy seeking or no seeking at all. But these files are now causing troubles even in MPC and WMP. The only player that can process such files is VLC: it reports zero length (0:00:00.000), but is able to play and seek without problems.
What am I doing wrong? I've tried several recent versions of aforementioned software, and found no difference in its behaviour, so I believe it's not a bug of software but a feature of MPEG streams or container. Strangely enough, I never heard of any such pitfalls, including numerous FAQs and guides posted here.
PS. I could publish some samples, if needed, but they are obviously large, about 35 MB per minute.
The source of my materials is a digital camcorder which outputs MPEG-PS files, with .mod extension, containing MPEG2 video (SD, 4.5 Mbit/s) and AC3 audio (stereo, 256 kbit/s). When I simply play these files with any software, everything is fine. When I crop them in time domain, using AviDemux and the same output format, everything is still fine. Well, I notice a small difference of reported duration, depending on player software, but this is negligible — only a couple of seconds for a 10-minute video.
But I run into a huge difference when trying to remove original audio: resulting files are reported to be approximately half-length (about 40–60 % of real duration), and are not seekable, or disrupt the sound after seeking.
My first method was to replace the audio track with a pre-generated quiet noise, also AC3-encoded (with FFmpeg). I accomplished this by means of AviDemux's standard function. When playing, SMplayer and VLC report bad duration, confuse at seeking and stop audio after seeking. (I also found that SMplayer isn't able to seek through AC3 soundtrack in a separate file, whether it's an original track or a substituted one.) However, in Media Player Classic and Windows Media Player those video files seem to play well.
My second approach was to use Mencoder instead of AviDemux. The resulting files opened fine at least in SMPlayer, but it was not too long before I discovered that the output format that Mencoder automatically switched to (with some files only, but not with other, which is very strange), was AVI. Because I heard that putting MPEG streams inside AVI container is a bad manner, I forced the format to be MPEG-PS. It produced the most strange files, which SMplayer tried to play at 10x speed without sound.
Then I deciced to get just a raw MPEG video stream. Both AviDemux and Mencoder produce the same result, which have the same problems as the first method: bad reported length, glitchy seeking or no seeking at all. But these files are now causing troubles even in MPC and WMP. The only player that can process such files is VLC: it reports zero length (0:00:00.000), but is able to play and seek without problems.
What am I doing wrong? I've tried several recent versions of aforementioned software, and found no difference in its behaviour, so I believe it's not a bug of software but a feature of MPEG streams or container. Strangely enough, I never heard of any such pitfalls, including numerous FAQs and guides posted here.
PS. I could publish some samples, if needed, but they are obviously large, about 35 MB per minute.