Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I tried to slice up a dvd into chapters and encode each chapter separately to avi, then merge the avi's again, like this:
# slicing
mencoder dvd://1 -ovc copy -oac copy -chapter 1-1 -o chapter01.mpeg
mencoder dvd://1 -ovc copy -oac copy -chapter 2-2 -o chapter02.mpeg
# encoding the slices
mencoder chapter01.mpeg -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000 -oac mp3lame -lameopts cbr:br=64 -o chapter01.avi
mencoder chapter02.mpeg -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000 -oac mp3lame -lameopts cbr:br=64 -o chapter02.avi
# merging
cat chapter01.avi chapter02.avi > chapters01-02.avi
# fixing
mencoder chapters01-02.avi -noidx -avc copy -oac copy chapters01-02.fixed.avi
The problem: there will be an audio delay of cca. 2s inside the merged avi, starting from the original boundary of the two avi's (so, the first half of the avi will be correct, the other half corrupted).
When I play chapter02.avi, there is no audio delay, so the delay may be caused by mencoder, when fixing the merged avi.
It turned out that it was actually a mencoder bug that affected the splitting command. But there was a workaround: just add a single mencoder command line option and everything is OK.
So, one can use mencoder for splitting and joining avi's, too.
I just realized that mencoder preloads the audio data during encoding. What is worse: it does not seem to throw away the preloaded, surplus audio-data at the end of the encoding process, but inserts them into the last encoded frame.
You do not notice this when you play the slices: the playback of each slice will be correct.
But, when you merge the slices, the surplus audio data at the end of the first slice will delay the audio data of the second slice by cca. 1s, when you merge the avi slices as described in the mencoder documentation. If you have more slices, then the audio delay will gradually increase all along the merged avi.
My findings seem to be valid for avi files, only, and not for dvds :-(:
I splitted an avi into 38 parts by mencoder, then I merged them by mencoder again, and I got an audio delay of cca. 19s (which in fact equals to 38 times the 0.5s default audio-preload value).
If I splitted the avi into 38 parts but used the -audio-preload 0.0 switch meanwhile, then there was no audio delay after merging the avi parts.
But: If I split a dvd into chapters, I get several errors like this during encoding of the parts into avi:
a52: CRC error...
Flushing video
Then I always get an audio delay after merging the separately-encoded avi parts.
I wonder why dvds behave differently in this case? Maybe it is a dvd seek problem with mencoder?
you cn make vcd slice with my code... would have to alter for SuperVCD (format, bitrate and the like).
the main reason for posting was to show a working example (for me anyway) of how you can delay the video slightly when chopping up a video from DVD, AVI or similar source.
which i wanted to do for the purposes of creating VideoCD's for watching stuff on my standalone dvd player, which I now can...
although I have been experiencing some delay in audio near the end of some AVI type movies but i blame the source (ie leeched).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.