obsolete ways of thinking

A while back I converted all of my old-and-decaying VHS tapes full of music videos to DVDs. (Well, all of the tapes that would still play at all, that is.) This was a pain in the butt. Then yesterday I tried to play one of them, and my DVD player wouldn't read it. It looks like the last track is scorched, and for some reason that renders the whole disc unplayable to a PS2 (though the iMac will play most of it).

This has made me see the error of my ways: what the hell was I thinking, trying to store things that I care about on little plastic discs? Haven't I learned this lesson many times over already? Why yes. Yes, I have. I should have been storing them as normal files in my well-backed-up home directory all along, just like I do with music.

So of course I didn't save the original intermediate files, and find myself re-ripping from the DVDs I burned. (Well, I still have the VHS tapes, but I doubt I'm going to lose any perceptible quality by ripping from the DVDs, and that's faster).

What's the difference between MPEG4 and H.264? The files that Handbrake writes seem to be the same size (around 7MB/minute), but the Quicktime Player interface seems more responsive when playing H.264 than MPEG4.

I suppose it would be pointless to save the video at any resolution higher than 320×240, given the source material? Or might that lose detail, given how many trips through the encoding ringer they've made now?

Tags: , , , ,

58 Responses:

  1. herbie says:

    The source material itself has more than twice that vertical resolution, so there will be quality loss. Depending on the equipment used to do the ripping, though, that quality loss may have been at the capture stage, not at the transcoding one.

    • jwz says:

      But VHS is only 200 lines.

      But text is definitely sharper if I use 640x480.

      • dagbrown says:

        Yes, but it's interlaced to 400 or so.

      • taiganaut says:

        I'd absolutely use 640x480, even for VHS.

      • scullin says:

        VHS resolution is roughly 220 lines horizontal. Vertically it has the same resolution as NTSC, roughly 480 interlaced. Talking your CODEC into supporting that aspect ratio is probably pointless, though, so 640x480 is probably your best bet.

        • herbie says:

          What he said. It's very difficult to have analog TV sources that have different vertical resolution than TV, as the signalling format assumes a fixed vertical resolution. Since VHS is basically an analog record of the exact signals to send to the TV, and almost no image processing is required inside a VCR, running at anything but the native NTSC vertical resolution of ~480. Within each scanline, the "resolution" varies - in fact, each scanline is an analog function, so resolution really comes down to limitations of the recording, storage and playback equipment.

      • edouardp says:

        NTSC is 640x480 (modulo overscan).

        I've always found that technical people in the video biz who say "VHS is x lines" are stating more a subjective statement of quality, than an actual statement about, you know, the number of lines physically present on the media.

        My advice is to either encode at exactly the resolution that is stored on the DVD (as reported by Handbrake), or exactly half that resolution.

        If you decide to encode at full res, experiment with the "Deinterlace picture" on the "Picture Settings" pane. With interlaced TV as the source, you may prefer the deinterlaced picture.

        Encoding at half-res will automtically deinterlace the picture I believe, and maybe the quality of the original data, coupled with the smaller resulting MP4 files, justifies 320x240 over 640x480. Hard drives are getting pretty big these days though.

        • ninjarat says:

          Encoding at half-res will automtically deinterlace the picture I believe,

          It doesn't.

          Telecine is a problem. Telecine is the process by which 24fps film is converted to 30fps NTSC video for broadcast or DVD recording. It exploits the fact that NTSC video is 60 fields per second interlaced into 30 frames per second. Each 4 film frames (call them A, B, C, and D) are broken down into 8 fields (A1, A2, B1, B2, etc). Then the fields are blended in a sequence like: A1+A2, B1+B2, B2+C1, C2+D1, D1+D2 getting 5 frames out for each 4 frames in. The technique is called 2-3 pulldown because of the sequence of 2 interlaced frames and 3 progressive frames.

          What does this have to do with DVD Video? If the source video was telecined then the DVD recordings are probably also telecined.

          Back to the problem. Using the common resize algorithms (bicubic, bilinear, etc.) over the B-C-D frame sequences can look utterly craptastic. For example, if a scene change occurs between the B and C frames without a fade then the resized B2+C1 frame will be a blending of two very different half images. Yuck. The same thing happens during fast pans or for fast-moving objects. Super-yuck times the length of the sequence.

          The best option is not to resize.

          • baconmonkey says:

            agreed on the not-resizing, but you still get the annoying combing on high-motion images due to there being two interlaced fields being displayed on a progressive screen. any resizing should be coupled with a doubling in frame rate so that the fields are split by frame instead of discarded or blended - assuming the software has brains enough to do that.

            • edouardp says:

              Yeah - I'm leaning towards this (with or without half-sizing), unless you want to play the results back on SD TV again. In which case I don't know whether your movie player would regenerate interlaced fields from the non-interlaced 60fps source. Who knows.

              But in five years time, I doubt anyone will care about interlaced SD anyway... Here's hoping anyway.

            • ninjarat says:

              The best thing to do is a proper inverse telecine (IVTC) to recover the original progressive frames and eliminate all combing problems entirely. I'm told that Final Cut Pro can do IVTC. I have not yet found a set of free tools for Macintosh comparable to AviSynth and the Decomb package for Windows.

        • jwz says:

          So, Handbrake says "Source 720x480, output 640x480", but if I set the output width to 720, the aspect ratio is wrong. So I assume "640x480" is actually the "same resolution, no resampling" choice?

          • hermeticseal says:

            sort of. DVDs are 720x480 (or 704x480, dont ask why...) and either 16:9 or 4:3. so you probably want 720x540 or 853x480 so that you don't end up downscaling one of the two "native" dimensions.

            • hermeticseal says:

              so i guess what i'm saying is, will handbrake let you give an x by y output dimension? failing that, does it let you set an aspect ratio?

              if i were making a lavc .avi i'd just set the aspect ratio to 1.33 in the avi header and leave the video as 720x480. its better to scale at playback time.

              • jwz says:

                If "preserve aspect ratio" is checked, it will let me have 640x480 but not 720x480. If I uncheck that and set the width/height manually, the aspect ratio changes. It won't ever let height be more than 480, so I don't see any way to get 720 width plus correct aspect ratio. So it seems to be that 640x480 must be the right choice here.

                • hermeticseal says:

                  well, yeah, then 640x480 is pretty much the only choice here, but you are losing bits in the X direction. this seems to just be handbrake stupidity more than anything. maybe its geared toward 16:9 where the right thing to do is to scale the 720 axis.

                  oh well. "that's why i use MEncoder(tm)!"

                  • badc0ffee says:

                    Also, DVD pixels are not square. 640x480 on a 4:3 screen makes for square pixels, but 720x480 does not. To preserve all 720 pixels across you'd have to double lines here and there, much like when you scale VGA text mode (720x400) on a 4:3 LCD screen.

                  • edouardp says:

                    The NTSC DVD aspect ratios for non-anamorphic content is defined to be 1:1.5 I believe. Which is 720x480. PAL is closer, but still not 4:3. But the pixels are square regardless of the size of the canvas. Just drop the extra pixels and call them overscan.

                    Actually theres no point trying to make sense of anything to do with TV. It's all a bunch of half-arsed technical compromises made 70 years ago that they expected, at the time, they would fix when the "next" version came out in 5 years time. And then there's the mess you make when you try and take film (different frame rate, different aspect ratio etc) and try to make it fit TV.

                    The HD specs have almost fixed the problem. Apart from the interlaced modes. Computers have been able to cope without having interlaced modes for, oh, ever now. What were the HD people thinking? But apart from that, pretty sane.

                    And don't get me started on black points and gamma correction.

                  • hermeticseal says:

                    you guys are trippin'.

                    NTSC DVDs have exactly 2 aspect ratios: 4:3 and 16:9.


                    i used to hate the ATSC interlaced modes as well. but i eventually came to understand that its all a tradeoff. psychovisually, the interlacing stuff works really well, so it allows us to have 1920x1080i@60fields/sec for just slightly more bandwidth than 1280x720p@60frames/sec. also the open source tools (mencoder) have much better support for pullup of interlaced material than for decimation of progressive material, when you're trying to get from 60i/60p to 24p. so i dont have interlacing that much anymore.

                    of course if the damn 720p TV stations would just broadcast the film-source progressive material as its stored on DVD, everything would be groovy. but instead, 9 times out of 10, they have hard-duped frames to get from 24p to 60p, and that sucks. it wastes bandwidth and makes my life harder.

                  • edouardp says:

                    Hmm, yeah - looks like you're right. I must be smoking crack. Those non-square pixels continue to mess with my head - my bad.

                    And I don't want good pull-up or pull-down or pull-anything. I just want the FPS to match the source, and for there to be no interlacing. Is that asking too much?

                    Anyway, I have no HD of any sort where I live. They've decided to bring in a new digital broadcast system at great expense (http://digital.tvnz.co.nz/). But no mention of HD. So I'm guessing when it goes live in a year or two's time, it will be completely obsolete. Yay. I need a second home in Japan. And a big wad of those IPO dollars they used to hand out like candy.

                  • I am not a video technologist, but I do have a computer science degree, and I'm hazarding a guess you're somewhere in the same ballpark.

                    Considering interlacing to be compression. Granted, it's an engineer's version of compression (it cheats by not giving you everything, since your visual cortex can't process it that fast anyway, so who cares) rather than strictly CS compression, but it's doing the same damn job.

                    My friends in robotics who are computer scientists want the little robot to Learn Things about the World. My friends in robotics who are engineers want the big robot to rescue people in disasters/explore Mars/whatever. While I understand both of these, I fall on the side of the engineers when I'm going to give money for it. I think the same applies here, even if it does make digital video archiving more complicated.

          • edouardp says:

            I think Handbrake is assuming all DVDs are anamorphic. Non-square pixels. "Yay".

            As long as the number of lines matches (so, 480), and the aspect ratio looks OK in the output files, I think you should be OK.

            • ninjarat says:

              No. Anamorphic DVDs are 720x480 just like non-anamorphic DVDs. What is different is the shape of the pixels.

              • edouardp says:

                No, really, I do know that. What I'm saying is Handbrake, unfortunately, appears to be assuming an anamorphic default somewhere along the pipeline, and performing a horizontal scaling operation if the input and output resolutions are 1:1. If I've understood the description Jamie was giving correctly.

                Since I don't have a DVD created from a TV source on hand, I'm just offering some suggestions based on the comments above to try and help with the task at hand. Hopefully Mr. Zawinski is getting some joy from all this.

                • edouardp says:

                  Actually I remember coming across this problem when I was ripping a DVD of Spike Jonze videos to play on my machine, since there was a mix of anamorphic and non-anamorphic material. They all look fine now, so I must have found some way of doing it, but I can't remember exactly what I did. And, as I said, I don't have any source material to play with here, so unfortunately I've run out of suggestions to help.

                • ninjarat says:

                  The video may have been captured and encoded at 640x480 rather than 720x480. In that case Handbrake is doing the correct thing by reporting the real resolution of the video as embedded in the MPEG-2 stream.

                  I hope *someone* is getting some joy from this. Working with analog video can be a Grade A PITA.

          • ninjarat says:


            Standard MPEG-2 resolution for DVD-Video is 720x480 (720x512 for PAL). Many video capture devices only capture at 640x480. That is still an acceptable resolution for MPEG-2 video (MPEG-2 video must be multiples of 16x16 blocks) though it might not play on some DVD decks.

            Anywhere that I've said "use 720x480" substitute "use 640x480" and you should be okay.

          • baconmonkey says:

            TV pixels are tall and skinny, not square. the pixels have a .909 aspect ratio, so 720x480 video works out to 655x480 when sacling for square pixels. software that scales things accurately will often leave about 5 pixels black on the top and bottom of a 720->640 resizing.

            widescreen DVD still uses 720x480 pixels, but uses a 1.212 pixel aspect ratio.

  2. supersat says:

    It depends on what you mean by "MPEG4." MPEG-4 is a giant standard with many parts. Traditionally, MPEG-4 video has been specified by part 2, which is what divx, etc. all basically are. There's also a newer part 10 (Advanced Video Coding) that is identical to H.264. H.264 totally blows part 2 out of the water.

    • jwz says:

      What I mean by "MPEG4" is "when I select MPEG4 from the menu in HandBrake". "Get Info" in QT Player calls it "Apple MPEG4 Decompressor, Millions, AAC Stereo 100kHz".

      • sherm says:

        The naming thing is a clusterfuck.

        When Apple says MPEG4, it means Part 2. When it says H.264, it means Part 10.

      • edouardp says:

        The hand-wavy version of explaing MPEG 4 is that it contains two video codecs - a good one and a better one. The better one is more complex and takes a bit more CPU grunt to decode.

        The *good* one came out first, and so everyone started calling it simply "MPEG 4", and files encoded with it ".mp4" files. It's also known as "MPEG 4, Part 2". And "MPEG 4 Simple Profile" or "MPEG 4 Advanced Simple Profile" video.

        And it's basically what's inside DivX as well. So some people call it DivX too.

        The *better* is called "MPEG 4, Part 10" or "MPEG 4 Advanced Video Codec" or "MPEG 4 AVC". And it was adopted by another standards body (the ITU) and so is also known as "H.264" (the name of their standard). Apple tends to call it "H.264". The files can be called all sorts of things, but ".mp4" and .h264" are both popular (both of which should be regular MPEG 4 files).

        It's also one of the video codecs adpoted for cell-phones, so you get some files on the interweb called ".3gpp" which are in fact H.264/MPEG 4 AVC files.

        Clear as mud, huh?

        But none of that really matters to you - all you care about is the pulldowns in handbrake.


        You want the file format to be "MP4" - that's the container, and I deem it good.

        And then you get to choose the video (and audio) codecs from the next pulldown. The two choices are "MPEG-4 Video / AAC Audio" and "AVC/H.264 Video / AAC Audio".

        The first uses the open source library "FFmpeg" which can encode MPEG 4, Part 2. The second uses the open source library "x264" which can encode MPEG 4, Part 10 (H.264).

        Now, in theory, H.264 should be better than MPEG4, Part 2, but since these are completely different code-bases and developers writing them, and both codecs are quite complex and have all sorts of optional parts you don't actually have to use, you can't actually just assume that the H.264 encoder will produce better results than the MPEG4, Part 2 one. Kinda like how a crappy MP3 encoder at 192kbps can actually sounds worse than a really good encoder at 128kbps.

        So you need to try them both out and discover which one works best on you data, at the bitrates you want.

        My, very limited, experiments seems to indicate that, at low bitrates at least, they produce about the same quality video. I'm guessing this is because FFmpeg is a more mature and tuned codebase. In fact I preferred how FFmpeg handled low-light scenes - it produced a less blocky image I thought.

        Of course you get what you pay for, and the professionals will use a professional program like Sorenson Squeeze (http://www.sorensonmedia.com/solutions/prod/comp_win.php). That will produce very high quality output, but I'm guessing you don't need that good a product for VHS tapes.

        As always, I apologise for not producing a simple, black and white answer to your problem.

        • anyfoo says:

          Wow, thank you. I always wondered about the "newer" video codecs (I knew figuring them out could be tricky, but I didn't know their names would be THAT ambiguous) and now I finally know. Great answer, might save me a lot of trouble in the future.

          Remains to say: what did they take before coming up with that mushy pool of almost identical meaningless names? For once, I actually do not want to try that stuff out.

        • violentbloom says:

          and were you to be trying to play these back on a phone (H.264) you would find that framerate becomes really important, and also lead and end space or the audio would start before the video finishes loading, depending on the phone, version of the phone's os, and of course the player.

          whimper. and I was whining about cross-platform testing on the web! welcome to the next level of hell.

  3. boggyb says:

    Of course, now what happens is something (software or hardware, seen both) decides to scribble garbage all over your home directory, and that garbage then gets treated as "good" and backed up. Or you hit the more classic one of finding out that your backups are not working, and have not been working since the day after you set it up and checked it was all working.

    • ultranurd says:

      I think of keeping things on my active hard drive and backup drives as constantly pouring my data between cups, so that if one cup cracks, it's in my hands and I can hold it over the other cups as my data drips out, and before the cup ruptures completely.

  4. ninjarat says:

    H.264 is MPEG-4 Part 10.

    When Apple software says "MPEG-4" it means "MPEG-4 Part 2", the same codec specification and collection of profiles that DivX and XviD (and a few others) use. When Apple software says "H.264" it means "MPEG-4 Part 10", also known as "AVC" for "Advanced Video Coding". Handbrake follows this convention. MPEG-4 Part 10/AVC/H.264 offers much better video quality than MPEG-4 Part 2 at the same bitrate.

    MPEG-4 Part 2 is not MPEG-2.

    When I do backups/copies to non-RAID media, like DVD-R, I include PAR files in case the media becomes partially unreadable. It doesn't solve your current problem but it can help prevent it from being a problem again.

    VHS is 240 lines interlaced to 480 lines and the VOB files were probably scanned at 480 lines to match DVD Video resolution (assuming NTSC; 512 lines for PAL). If you reduce to 320x240 you will get crappy looking video if you ever play it back at TV resolution or higher because of the shrink-expand cycle. I suggest size reduction only for playback on PSP, iPod or similar small screen devices. Keep the full 640x480 or 720x480 (depending on original MPEG encoder) resolution for archives.

    When I transcode VOBs to H.264/AVC for my PSP I usually do two pass at 768kbps. I get some artifacting but it usually isn't bad unless the source video is bad. Commercial UMD Video is AVC at 1500kbps. I note this just as a reference. For archives I would use that bitrate.

    • omni_ferret says:

      When I do backups/copies to non-RAID media, like DVD-R, I include PAR files in case the media becomes partially unreadable. It doesn't solve your current problem but it can help prevent it from being a problem again.

      I like parchive2 a lot; it takes something like half an hour per DVDR for me. I keep an extra copy of the par2 files on a hard disk. It recognizes files within an (potentially corrupted, even) ISO file, so unless I simply lose the disk, or over 5% of it, everything's recoverable.

      Regarding video backup: Backing up the raw capture is impractical. Offhand, saving a large MPEG4 to DVDR is a good way to save better-than-DVD quality without eating up lots of space. And by MPEG4, I was thinking xvid, though H.264 might be more interesting. I'd save a disc at whatever native capture res is, & a disc as a video DVD.

      Regarding video capture from VHS: You know about time base correctors & proc amps & that sort of thing, right? I've heard they can help out quite a bit.

  5. daruku says:

    I thought PS2s weren't able play recorded media because Sony is scared of pirates...

    • jwz says:

      Nah, it's been able to play everything I've tried. I believe it even works with data-CD-that-has-a-WMV-file-on-it.

      And it has the best controller of any DVD player I've ever owned.

    • ninjarat says:

      PS2 can't play copied game discs. Other media plays just fine if it plays at all.

    • valacosa says:

      The PS2 is finnicky, but that's not where the line is drawn.

      One of my friends once bought the Escaflowne box set. DVDs 5 and 6 wouldn't play, but the rest were fine. Who knows why the PS2 didn't like those particular two discs?

      • Highly irrelevant to <lj user=jwz>'s original question, but maybe a point of interest for those putting lots of discs through PS2s: the laser in that device loses focus/gets dirt/gets banged up over time. But you can fix it yourself by removing the cover on the case and dialing the little white gear/wheel a bit, which changes the inclination (and, thus, focus depth) of the laser module. (Doing this repatedly, testing disc loading in between to get the right setting, took a friend's second-rev PS2 from "only loads some non-DVD PS2 games" back to "loads all PS1, PS2, DVD, DVD-R, and so forth".)

  6. hermeticseal says:

    it turns out that its very easy to make bad DVDs, depending on the compatibility of the burner and the media, the quality of the media, the phas e of the moon, etc. even if it verifies okay, it may have buttloads of ECC-corrected errors on it, greatly reducing its shelf life.

    if you care to return to DVD as an archival medium, check out cdspeed2000. burn a test disc and scan it, and if it's got good parity error statistics, then you should be good to go for 5-10 years with discs from that brand/burner/speed combination...

    • rapier1 says:

      This reminds me of something. The library of congress is preserving a set of audio recording on what they consider to be the very best media for archival storage. Lacquer records recorded at 78rpm.

      Of course, I can't find anything on the innernatwebbers about it now :\

      yes, this is apropos of very little.

  7. ninjarat says:

    I've twice mistakenly listed PAL DVD resolution as 720x512. The correct resoluion is 720x576.

  8. bazil says:

    Do you do anything special as far as data storage goes for that home directory, besides backing it up? I keep looking at Buffalo and Lacie's RAID drive solutions for media storage, but it's hard to look at them and not go 'wow. I could buy another machine, stick a pair of unmatched RAID 0 hard drives in there, and still be cheaper than this Porsche Hard Drive With Cupholders!'

    • jwz says:

      No, RAID is a complete waste of time and money unless you're running a server with serious uptime requirements. Putting RAID of any kind in a desktop machine is just dumb. I regularly back up my main machine to the disk on another machine in the same room via rsync (meaning: I also see which files differ, so I'll notice if something unexpected happened on either drive) and every six months or so I back up to a firewire drive that I store off site.

  9. violentbloom says:

    hmm http://en.wikipedia.org/wiki/ITU-T wikipedia has a surprisingly comprehensive group of the standards.

  10. fcassia says:

    Two things:

    1. Use mpeg4, save as .mp4. It's a standard. Who cares about Quicktime? Quicktime uses mpeg4 but adds a propritetary Quicktime wrapper around it. Do you really like to please Steve aka the Gates wannabe?. You might find yourself trying to access the files from a different OS in the future, so why not go the open standards way?.

    Actually, on second thought, have you heard about Ogg Theora?


    ^to play ogg theora files in Mac OS-X.

    2. NTSC video is ~ 480 vertical lines. So you should really encode video at 640x480 and you'll get rougly the same resolution as VHS video.

    Hope this helps...


    • jwz says:

      And thus -- 36 hours after the question has been answered in such uselessly obsessive detail that even the pedants have tired -- out come the trolls.

      • dzm6 says:

        There is something reassuring about the cycle of life that a Call For Help on the Lazyweb has.

        At least nobody has suggested that you switch back to Linux and recompile your kernel.

        • masque__ says:

          Actually, I was just about to suggest that recompiling the kernel may make mpeg4 faster, much like pinstriping for cars.

    • orangepeople says:

      the .mp4 container actually is .mov. MPEG adopted the quicktime format as their standard. Also, H.264 inside a .mp4 container is your best bet, as it is the highest quality that most modern software and hardware accepts. Ogg Theora is great, but I have yet to see a hardware player. For audio I would go with Ogg Vorbis (high quality for smaller files), but AAC or mp3 would be more compatible.

      You might want to attempt to reduce the frame rate, because some dvd's are unnecessarily 60fps (interlacing).