Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Linux, Mac OS X, & Co

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th March 2003, 08:10   #1  |  Link
spankmeister7
Registered User
 
Join Date: Oct 2001
Posts: 17
problemen mit encoding and appending avi files

[Apologies for the cross-posting. This query also appears at the SF mjpeg-users mail list. I'm putting here because some the material might be answered with tools not stemming from mjpegtools.]

I've been spending some time getting to know mjpegtools and other video resources better so I can create a process for myself to import VHS tapes and encode them to mpeg2 and write them to DVD. As such,
I've been pouring over the readme's and howto's and whatnot but I have an issue I can't seem to get past.

Here's what I'm doing: I'm using lavrec to import 2 hours of video at a time from my vcr with my G400-TV. This gives me about 15 avi files ranging from 1.5-1.8 gigs each. I open the first with avidemux, append the next fourteen, and run three filters to crop, resize, and detinterlace (this is all NTSC). This gives me one big avi. When I play the avi in either MPlayer or Xine, it runs fine.

But since I need to encode this to mpeg2 (going by the mjpeg dvd how-to and other resources) I rip the audio either by using lav2wav or lavtrans, and then I rip encode the video using lav2yuv:

lav2wav hercules.avi | mp2enc -o hercules.mp2

lav2yuv hercules.avi | mpeg2enc -n n -M 2 -f 8 -s -r 16 -o hercules.m1v

And then for multiplexing them to mpeg2:

mplex -f 8 hercules.mp2 video.m1v -o hercules.mpg

When I go to play the mpg file it looks great for about 8-10 minutes, and then the video freezes and the sound becomes a screeching blast of white noise. I checked the mp2 file, and that seemed to be the
problem as it screeched also when I played it alone. I then took a different approach of going back to my 15 original avi captures and ripped the audio from them individually instead of collectively, and then appending them together in a wav editor. After re-encoding this gives me a perfect sounding mp2. Using this new mp2 file I re-encode the whole thing to mpeg2 again with lav2yuv.

This time when I play the file the video simply freezes at the exact same spot as last time but this time without the white noise screech.

At this point I think there must be something wrong with the way avidemux appends or saves the avi file. So I come back to the shell to try without visual aids. Since then I've been trying to use every tool I can find that I think I can substitute for avidemux including using lavtans as described in the mjpeg-howto under the "Unify videos" section. This starts to work until it hits 2-gig file size and then craps out. The how-to warns of this IF "there is the 2GB file-size-limit on 32Bit systems with an older glibc." I'm using RedHat 8.1 beta (phoebe) with glibc-2.3.1-46, so I'm not convinced that is my problem.

Mencoder also hits this 2-gig file barrier, but then creates additional 2-gig files until its finished encoding.

So as it stands now I'm just trying to get a single giant m1v file that doesn't freeze, or identify what is happening that makes it freeze to begin with. The only way I can seem to get a single avi file is with avidemux, which could be causing my freeze problem, and I can't get a single avi file with lavtrans without encurring the 2-gig file limit. Also, it might be worthy of noting that the freeze point always happens at the exact same frame, and this is not a transitional point between two appended files. I'm really starting to wonder if the giant avi I create with avidemux plays 2 gigs worth of data and then freezes, but the math doesn't pan out that way.

I'm also concerned that even if I do get past the file size limit that any new mpeg2 encodings will produce the same freezing problem. I'm starting to think that I'm going about this all wrong by appending it all together into huge audio and video files before splitting and encoding.

I'm confused to the point that I now seek the wisdom of my betters.

*grog* I need to sleep.
spankmeister7 is offline   Reply With Quote
Old 19th March 2003, 08:22   #2  |  Link
mean
Registered User
 
Join Date: Jan 2002
Posts: 206
dumb question : i understood you create an intermediate avi file.
Avidemux can use mjpegtools to directly export to mpeg
File->export mpeg->Svcd /DVD

Might be worth a try ?
mean is offline   Reply With Quote
Old 19th March 2003, 18:23   #3  |  Link
spankmeister7
Registered User
 
Join Date: Oct 2001
Posts: 17
export mpeg-> DVD

I tried that first and forgot about it until right this second. There were a few problems with that:

1) After creating the large unified avi in avidemux, I could not reopen the same file in avidemux later. It would either just freeze up or say "Could not open that file!" Not very helpful.

2) I later went through the process of appending a new file and running the filters and then doing as you suggest. But this didn't work either in that it usually worked for about 5 minutes before giving me the cryptic message, "failed!"

There are a few questions I have about avidemux in this way. There is nothing the docs about how to actually use this function, or what options I can give it when saving. Or why when saving as mpeg2/dvd the box title is "MPEG 2 VBR," when you don't want to encode DVDs with VBR. I chose to use FFMPEG as the video codec, and under options (also not explained in the docs) I choose CBR but this doesn't change the header. It's probably just a glitch for a window title, but it leaves me uneasy.

I just went back to try this again, using a value of 9500 for the bitrate and leaving the (somehow quickly forgotten other option) at 7. I'm not even sure is this is creating an m1v, m2v, or mpg file. But it appears to be chugging along.

Hmm. It also appears to be using mpeg2enc for the encoder. I didn't know what before. I guess I can use standard mpeg2enc flags, but even then I'm not sure which are already being used.


Anyway *this* is why I'm not using avidemux to do this kind of work: very few questions to ask me, and very little information to present to me in that I have little idea of what its doing at any given time.

I'll let this encode and report my results. Looks like this will take 322 minutes.
spankmeister7 is offline   Reply With Quote
Old 19th March 2003, 18:55   #4  |  Link
mean
Registered User
 
Join Date: Jan 2002
Posts: 206
1) If you just append the avi and save it you will end up with a 15 GB avi which is outside avi spec.

2) Look at the console (start avidemux from a xterm)
Generally there is the cause of error there

3) The only option specified is Quantizer/type and max bitrate
and it may be overriden by the input field.
BTW, mpeg2enc does not do CBR. So avidemux neither.

The flags used by avidemux are printed in the console window.

I understand your points and agree, but there is a choice to make between :
- simple to use with limited settings : avidemux
- very tweakble and complex cli interface : transcode / mencoder

You may find transcode more suitable to your wish as it is possible to have control about everything it does.
mean is offline   Reply With Quote
Old 20th March 2003, 18:51   #5  |  Link
spankmeister7
Registered User
 
Join Date: Oct 2001
Posts: 17
better

Hmm. Its working now that I've reduced some of the options, for the most part. But I still have a couple of lingering questions:

When I chose to save as mpeg2/dvd, I noticed that the quantisation has a range of 2-31. I read in the mjpegtools documentation that if the -q flag is not given, then mpeg2enc will not use VBR but CBR, which is needed for most hardware dvd players. If I set the quantisation to -q 0, does this do the same thing?

Also, once finished encoding the resulting mpeg file do you think I should use mplex to mux in the .mp2 file I've already created, or this this possible using avidemux?

Lastly, I'm going to need to figure out how to generate my 4-gig mpeg file into proper DVD format with the video_ts structures, 1.8 gig file limits, etc. I've noticed that when I use mplex to mux together the .mp2 and .m1v files I often get errors related to using too many buffers and the sound will not play but ONLY IF my output m1v file from mpeg2enc is over the 2gig limit. This is why I'mm asking if there is a more streamlined process I should be using.

In the end, I really think avidemux is a great tool. You're absolutely correct in seeing the balance between ease of use on one hand and total control from the command line on the other. I am also trying to find a balance but I still want to use avidemux as much as possible. Coming from a place where I was using VirtualDub for all of this kind of work, its easy to forget the gritty details of what you (We) are actually doing here.

Thanks,
Marcus
spankmeister7 is offline   Reply With Quote
Old 20th March 2003, 19:45   #6  |  Link
mean
Registered User
 
Join Date: Jan 2002
Posts: 206
Re: better

Quote:
Originally posted by spankmeister7
Hmm. Its working now that I've reduced some of the options, for the most part. But I still have a couple of lingering questions:

When I chose to save as mpeg2/dvd, I noticed that the quantisation has a range of 2-31. I read in the mjpegtools documentation that if the -q flag is not given, then mpeg2enc will not use VBR but CBR, which is needed for most hardware dvd players. If I set the quantisation to -q 0, does this do the same thing?
I must admit i only did the VCD part, SVCD & DVD parts were done by JSC and i havent looked in the detail. I will ask him to reply to you.

Quote:
Originally posted by spankmeister7
Also, once finished encoding the resulting mpeg file do you think I should use mplex to mux in the .mp2 file I've already created, or this this possible using avidemux?
You can use mplex or tcmplex from transcode. It is not possible in avidemux (maybe in avidemux2).

Quote:
Originally posted by spankmeister7
Lastly, I'm going to need to figure out how to generate my 4-gig mpeg file into proper DVD format with the video_ts structures, 1.8 gig file limits, etc. I've noticed that when I use mplex to mux together the .mp2 and .m1v files I often get errors related to using too many buffers and the sound will not play but ONLY IF my output m1v file from mpeg2enc is over the 2gig limit. This is why I'mm asking if there is a more streamlined process I should be using.

-- snipped --
With dvdauthor ?
(from sourceforge)

I will add command line args for SVCD & DVD
They already exist for VCD so that you can make a small shell script
that does everything including muxing, generating the image to be burnt without human presence
mean is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:09.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.