Linux - Software This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
01-15-2005, 12:49 PM
|
#1
|
Senior Member
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126
Rep:
|
Mencoder: audio delay when encoding in slices!?
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.
Is it a known bug? Is there a workaround?
Last edited by J_Szucs; 01-15-2005 at 12:57 PM.
|
|
|
01-17-2005, 02:25 AM
|
#2
|
Senior Member
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126
Original Poster
Rep:
|
Problem solved.
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.
Last edited by J_Szucs; 01-17-2005 at 02:30 AM.
|
|
|
01-17-2005, 02:30 AM
|
#3
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
and that option would be?
|
|
|
01-17-2005, 02:41 AM
|
#4
|
Senior Member
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126
Original Poster
Rep:
|
-audio-preload 0.0
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.
Last edited by J_Szucs; 01-17-2005 at 02:53 AM.
|
|
|
01-22-2005, 08:58 PM
|
#5
|
Senior Member
Registered: Nov 2001
Location: Budapest, Hungary
Distribution: SuSE 6.4-11.3, Dsl linux, FreeBSD 4.3-6.2, Mandrake 8.2, Redhat, UHU, Debian Etch
Posts: 1,126
Original Poster
Rep:
|
Problem not solved :-(.
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?
|
|
|
06-24-2006, 04:18 PM
|
#6
|
LQ Newbie
Registered: Jun 2006
Distribution: NetBSD 3
Posts: 2
Rep:
|
force video delay
for mpeg encoding with -mpegopts option, i messed about with init_apts (eg=init_apts=700) and init_vpts (eg init_vpts=100).
works for me using the following:
(other parts of the script are similar, ony ss (start time) and endpos are different... plus i dont use init parts on the first slice)
mencoder -audio-preload 0.0 \
-oac lavc -ovc lavc -of mpeg -mpegopts format=xvcd:init_vpts=700:init_apts=100 -vf \
scale=352:288,harddup -srate 44100 -lavcopts \
vcodec=mpeg1video:keyint=15:vrc_buf_size=327:vrc_minrate=1152:vbitrate=1152:\
vrc_maxrate=1152:acodec=mp2:abitrate=224 -ofps 25 \
-ss 01:00:00 -endpos 02:00:00 -o /disk2/videos/converted/$1.out.2.mpg $1
hope this solves
P
also  ... put the result through vcdimager and cdrdao, hey presto a a/v synced vcd
Last edited by netpup; 06-24-2006 at 04:21 PM.
|
|
|
06-24-2006, 06:19 PM
|
#7
|
Senior Member
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897
Rep:
|
Do you mean you can create a SVCD with several chapters or even several titles this way?
Yves.
|
|
|
06-25-2006, 05:30 PM
|
#8
|
LQ Newbie
Registered: Jun 2006
Distribution: NetBSD 3
Posts: 2
Rep:
|
svcd / vcd
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).
|
|
|
All times are GMT -5. The time now is 03:38 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|