Lossless Encoding

Archive of historical feature requests.
Please use the GitHub link above to report issues.
Forum rules
*******************************
Please be aware we are now using GitHub for issue tracking and feature requests.
- This section of the forum is now closed to new topics.

*******************************
Post Reply
ItsInTheCave
Posts: 15
Joined: Sun Feb 04, 2007 1:01 am

Lossless Encoding

Post by ItsInTheCave »

I'll admit before I begin that I know next to nothing about the technicalities of encoding for either video or audio; I just like the best quality possible so if there's any reasons this won't work or cannot be done please state so.

This is just a thought but seeing as DVDs are encoded in MPEG-2 an old encoding method, and that MPEG-2 has of course been replaced with MPEG-4 AVC, would it not be possible to have the exact same visual quality from the DVD inside the MPEG-4 taking up less memory? After reading up about MPEG-4 I've discovered that it can apparentely handle lossless encoding so my question is, could this be done?

Lossless audio would be nice too but I don't know if or how this could work. Maybe the original audio could be preserved and not changed at all or maybe it could be encoded in the Apples Lossless Encoder or FLAC perhaps?
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Lossless Encoding

Post by jbrjake »

ItsInTheCave wrote:I'll admit before I begin that I know next to nothing about the technicalities of encoding for either video or audio; I just like the best quality possible so if there's any reasons this won't work or cannot be done please state so.

This is just a thought but seeing as DVDs are encoded in MPEG-2 an old encoding method, and that MPEG-2 has of course been replaced with MPEG-4 AVC, would it not be possible to have the exact same visual quality from the DVD inside the MPEG-4 taking up less memory? After reading up about MPEG-4 I've discovered that it can apparentely handle lossless encoding so my question is, could this be done?
While x264 (MPEG-4 AVC) can indeed do lossless encoding, you have to understand it would not be losslessly encoding the compressed video on the DVD. Instead, it would be losslessly encoding the raw uncompressed video stream after the DVD's MPEG-2 has been decoded. This takes up a *lot* of space (2 gigs for a 30 minute cartoon per this: http://forum.doom9.org/showthread.php?p ... post676513 ). If you really want it, though, I could implement it very easily.

However, if what you want is MPEG-4 AVC that looks the same as its source, that's easy without going lossless. Apple claims h.264 is transparent at approximately half the bitrate of the DVD source. But then, Apple's h.264 encoder sucks.

With HandBrake/MediaFork, use x264 and try setting a Constant Quality of 64-70%. That's a quantizer of 18-15, generally considered low enough to preserve all visible detail in the source video.
Lossless audio would be nice too but I don't know if or how this could work. Maybe the original audio could be preserved and not changed at all or maybe it could be encoded in the Apples Lossless Encoder or FLAC perhaps?
There really isn't any point to lossless audio with a DVD. The AC3 audio will already be lossy, so you're best off just passing that through--what I think you mean by "preserved and not changed at all." HandBrake/MediaFork already does this, but only if you use .AVI as your container. This is because .MP4 and .OGM don't support AC3 audio.
ItsInTheCave
Posts: 15
Joined: Sun Feb 04, 2007 1:01 am

Post by ItsInTheCave »

I didn't realise that the process worked like that. There is very little need for such a feature if it makes the file size larger I guess.

I asked for this feature because when I use a set bitrate when encoding DVDs the quality is always worse than the DVD I used to begin with. A better feature to fix these problems would be if the program could scan the DVD to begin with and suggest a bitrate that would be indistinguishable from the original. From what's been stated in the previous post this would make a better quality result, right?
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Post by jbrjake »

This might be a little controversial...I hope people with differing opinions will chime in. I know there are some people who find that it's as easy as encoding everything at 1500kbps, or whatever.
ItsInTheCave wrote:I asked for this feature because when I use a set bitrate when encoding DVDs the quality is always worse than the DVD I used to begin with. A better feature to fix these problems would be if the program could scan the DVD to begin with and suggest a bitrate that would be indistinguishable from the original. From what's been stated in the previous post this would make a better quality result, right?
There's really no magic formula that works for every DVD. It's not as simple as half the DVD bitrate, like Apple suggests (here: "H.264 provides DVD quality at about half the data rate of MPEG-2." http://www.apple.com/quicktime/technolo ... 4/faq.html). It should be a lot lower. Every movie is different, though. Film grain, motion complexity, and all sorts of other things affect the perfect bitrate for a particular movie. If you're not concerned about how big your output is, don't mess around trying to guess the best bitrate or file size. Just set a high constant quality, in the 60%-70% range. If you really want to eke out the most quality, take that file, compute its average bitrate, and then do another 2-pass average bitrate encode set to that target bitrate. I get that last bit as a little tip from doom9's forums: http://forum.doom9.org/showthread.php?p ... post885872

To put it another way, the only way to know "a bitrate that would be indistinguishable" from the source DVD would be to encode copies of the DVD until you got one you thought looked indistinguishable, and then checking its bitrate.
simifilm
Posts: 2
Joined: Tue Feb 13, 2007 7:12 am

Post by simifilm »

I think I could use such a lossless decoding option, or at least, just a simple "rip only" optin which would produced demuxed files.
thanar
Posts: 34
Joined: Fri Feb 09, 2007 11:16 am

Post by thanar »

Apple states that h264 achieves the same quality as the DVD at half bitrate, but that's when you have the source content fed to BOTH encoders.

Since we are talking about already compressed content here, there is NO way to preserve the whole quality without dramatically increasing the file size. Just like that.

Regarding AC3s inside AVIs, I think that it works just because AVIs are such a loose container, it accepts almost everything as tracks, as long as the player can cope with it. That is, no standards. I remember the first months divX came out from asf, when it was hell buggy to play an AVI including an mp3 audio track in most players...
ripper7
Posts: 15
Joined: Wed Dec 31, 2008 9:58 pm

Re: Lossless Encoding

Post by ripper7 »

i've stored lossless (video) 1080p high definition clips on my computer. i think we are ready for lossless standard def encoding, which would be very beneficial for archiving rarities. lossless audio is ready too: "HandBrake is no longer limited to DVDs...". it would be great to have a flac option obviously, but i would be happy with raw WAV.
nightstrm
Veteran User
Posts: 1887
Joined: Fri Mar 23, 2007 5:43 am

Re: Lossless Encoding

Post by nightstrm »

ripper7 wrote:i've stored lossless (video) 1080p high definition clips on my computer. i think we are ready for lossless standard def encoding, which would be very beneficial for archiving rarities. lossless audio is ready too: "HandBrake is no longer limited to DVDs...". it would be great to have a flac option obviously, but i would be happy with raw WAV.
Lossless video? How do you get the uncompressed video, and how many terabytes of hard drive space do you have?
nightstrm
Veteran User
Posts: 1887
Joined: Fri Mar 23, 2007 5:43 am

Re: Lossless Encoding

Post by nightstrm »

nightstrm wrote:
ripper7 wrote:i've stored lossless (video) 1080p high definition clips on my computer. i think we are ready for lossless standard def encoding, which would be very beneficial for archiving rarities. lossless audio is ready too: "HandBrake is no longer limited to DVDs...". it would be great to have a flac option obviously, but i would be happy with raw WAV.
Lossless video? How do you get the uncompressed video, and how many terabytes of hard drive space do you have?
MPEG2/MPEG4/AVC/VC1 is still compressed...
ripper7
Posts: 15
Joined: Wed Dec 31, 2008 9:58 pm

Re: Lossless Encoding

Post by ripper7 »

nightstrm wrote:
ripper7 wrote:i've stored lossless (video) 1080p high definition clips on my computer. i think we are ready for lossless standard def encoding, which would be very beneficial for archiving rarities. lossless audio is ready too: "HandBrake is no longer limited to DVDs...". it would be great to have a flac option obviously, but i would be happy with raw WAV.
Lossless video? How do you get the uncompressed video, and how many terabytes of hard drive space do you have?
lossless video is usually compressed, although i would settle for uncompressed. i don't plan on using it for an average encode, probably just for important clips. and i have 5 terabytes. i also make short films which would be a reasonable size with lossless video and have lossless audio sources.

edit: oh yea, lossless audio is pretty important for music dvds as well, many of which have LPCM audiotracks, i'm holding off of encoding them right now
Post Reply