PDA

View Full Version : XviD re-encoding


DiJayy
15th March 2006, 22:17
Is there any way to re-encode an xvid video to a lower bitrate without converting the video to frame-by-frame and encoding it from scratch again?

On linux? perhaps using transcode? Sorry if this is a dumb question.

Hard Core Rikki
15th March 2006, 22:34
Welcome to Doom9.

I dont really think there is. Re-encoding WILL necessarilly convert the video frame by frame.

I presume you wanted to make a video fit in CD's. If that's the case, perhaps you'd be better off making the video a little shorter, by removing trailers/intros/credits. Would come with NO quality loss. Perhaps thinking about lowering the audio bitrate a little would help you reach that objective as well.

Lowering bitrate does affects the relation between frames, depending on the encoding settings. A re-encode is necessary.

If you're pressed for time, just re-encode your video in VirtualDub or VirtualdubMod (though I recommend the later personnaly), but SINCE you will probably not use filtering, select FAST RECOMPRESS. This way, quality will not be lost due to colorspace conversions.

Hope it helps. You should've provided details on your objective btw.

Didée
15th March 2006, 22:38
No, there isn't. Full re-encoding is the only option.

Compressed-domain transcoding, like we have for mpeg-2 streams, should be possible to do, technically ... but I could imagine the results would be worse than those of full recodings. (Probably there's a reason that no such tool exists for mpeg-4 ...)

DiJayy
15th March 2006, 22:57
Compressed-domain transcoding looks promising, if there's a tool to use it with MPEG-4, please let me know.

Basically I've got several segments of a video encoded in XviD and I want to merge them (avimerge) and get the file to fit on a CD, and I am pressed for time. I also don't know the final runtime beforehand or I'd encode it at the right bitrate the first time around. If there are any other solutions to the problem I'd love to hear them. I can either encode the video undersized (quality suffers) or oversized (won't fit on a CD). I was hoping to encode it oversized then make it smaller through something like compressed-domain transcoding, it may just not be possible.

Teegedeck
15th March 2006, 23:41
Compressed-domain transcoding looks promising, if there's a tool to use it with MPEG-4, please let me know.As Didée has just explained, there isn't.

DiJayy
16th March 2006, 00:30
Yeah that's why I explained my problem. Looking for another solution.

Would re-encoding an XviD from a higher bitrate to a slightly lower bitrate look any worse than encoding to the lower bitrate from the start?

chilledoutuk
16th March 2006, 01:35
why dont you load the segments in an avisynth script load it in vdub and you will then in vdub be able to find the combined length.

DiJayy
16th March 2006, 02:58
It's an HDTV capture, I want to encode while I'm capturing.

foxyshadis
16th March 2006, 04:15
If you have a strong suspicion that you'll have to reencode anyway, it'd be better to simply capture at a much higher bitrate (q2-3) with a high bitrate matrix, and as soon as it finishes restart encoding. If you capture at a middling bitrate and reencode, you usually end up with extra artifacts or have to preprocess them away.

If you know how long the program will be, you could also set the bitrate in advance and encode 1-pass ABR. It won't be as good as it could be, but the size will be fairly predictable. (Set it a little under to be certain it fits, or you might have to reencode a few GOPs.)

DiJayy
16th March 2006, 04:27
If I know the runtime I can calculate the bitrate I should use, are there any sites that tell you the runtime of a TV show BEFORE it airs?

I tried reencoding an XviD at a slightly lower bitrate and the result looked like crap.

I'm capturing at a full 19mbps MPEG-2 transport stream, its the only option I have. If only I could find the total runtime before the whole program was captured... If I can get it to the minute I'd be fine. From what I can tell 1hr shows are always between 41 and 44 minutes, but that's not precise enough.

sysKin
16th March 2006, 05:44
Would re-encoding an XviD from a higher bitrate to a slightly lower bitrate look any worse than encoding to the lower bitrate from the start?

Significantly worse.

If I know the runtime I can calculate the bitrate I should use, are there any sites that tell you the runtime of a TV show BEFORE it airs?
I don't see why you need it. For any good encoding you need to do two-pass anyway, so you don't need to know the bitrate before show starts.

Actually I'm confused what are you doing exactly, because:I'm capturing at a full 19mbps MPEG-2 transport stream, its the only option I have.Very good, it's the only option you should use anyway. Capture the TS, then after you have it on your hard drive, index it and use all the avisynth magic to get your show as one piece. Then, use two-pass encoding with target filesize.
There's no need to know the length nor bitrate, nor any need to reencode from xvid to xvid at all.

DiJayy
16th March 2006, 06:21
Unfortunately that takes too long. Time is too important. I've figured out what I'm going to do now that I have some leeway but knowing the runtimes of the shows before I start encoding their segments.

I'm trying to encode segments of the show as the show is airing, then I'll combine the segments when the show is over. I know how I'll do it but having exact-ish, or to-the-minute runtimes of the shows would make the final result more accurate, which isn't as important as time in this situation. If you've any idea where I can get show runtimes that would help alot.

foxyshadis
16th March 2006, 06:55
Can you possibly capture to multiple sources at once? If time, size, and quality are both of the essence, saving the .ts while encoding it to xvid as a full-quality first pass would work, then set up a small render farm with elder4xvid to chew through the second pass as quickly as possible with perfect size matching. You can cut your time after down a lot that way, though it won't be done within minutes of the end, of course.

Otherwise, guesstimating 44 minutes for everything will have to work, since I don't know of any freely available program guide that'll subtract commercial time.

CWR03
16th March 2006, 07:43
If you're striving for any semblance of quality, you're better off capturing the entire show in a lossless format, such as HuffYUV or even a very high bitrate MPEG-2, then encoding it to your liking with a multi-pass method. The problem with saving directly with XviD is that you lose the ability to adjust bitrate where it's needed, such as slower motion frames needing less bitrate. Unless you select an extremely high single-pass bitrate in which you save it initially, you'll never achieve a good end file.

DiJayy
16th March 2006, 09:09
If you're striving for any semblance of quality, you're better off capturing the entire show in a lossless format, such as HuffYUV or even a very high bitrate MPEG-2, then encoding it to your liking with a multi-pass method. The problem with saving directly with XviD is that you lose the ability to adjust bitrate where it's needed, such as slower motion frames needing less bitrate. Unless you select an extremely high single-pass bitrate in which you save it initially, you'll never achieve a good end file.

Unfortunately time is important in this situation. I'm just going to guestimate the total runtime and thus video bitrate, if its off by a few MB I'll have to deal with it.

Didée
16th March 2006, 09:18
So you're capturing HDTV (1080i most probably), are in such a big hurry you can't even wait until the show has finished, the result has to fit on a CD, and should look good.

Seems you took the blue pill, not the red one ...

DiJayy
16th March 2006, 09:26
Its not difficult to do if you've passed elementary school mathematics and have a rough estimate of the program runtime, but thanks for the kind words.

Didée
16th March 2006, 09:45
No problem.

(Made it some stages beyond elementary, btw, and've been encoding for awhile already.) ;)

sysKin
16th March 2006, 10:51
I'm trying to encode segments of the show as the show is airing, then I'll combine the segments when the show is over.
Okay so how's this: if your file is too long, reencode one chosen segment only. Just like you said at first, except use the original TS stream as source, not xvid again. It's not even slower if you do that.

TS is not that big so storage over ~60 minutes can't possibly be a problem.