VideoHelp Forum




Results 1 to 7 of 7
  1. Member
    Join Date
    Nov 2005
    Location
    United States
    Search Comp PM
    Okay, I've probably spent too much time trying to come up with "optimal" settings when I encode video for my iPod. I like good TV resolution, so I have to use the XVID (ffmpeg) video encoder.

    Now, usually the best bitrate is estimated at Q*height*width*framerate/1024. FFMPEGX likes to default with Q=0.23 (a reasonable high-quality setting). As far as I understand, each frame is encoded with a perceived "compression factor" at the designated bitrate. Higher factor means less quality. That's why qmin and qmax represent higher quality at lower numbers.

    If the quality is better than qmin, then the bitrate is reduced a little for that frame. If the quality is worse than the qmax setting, then the bitrate is increased until the minimum quality is achieved. Rather nice, actually.

    However, if you set qmin=qmax, then the bitrate will ALWAYS fluctuate to achieve the desired quality. Simple frames take small bits, and complex frames take large bits. Dual-pass is meaningless since more bits are packed where needed on the first run anyways. I find I get a pretty nice quality/size ratio with qmin=qmax=3. If you want to bust out a high-qual movie, then set it for qmin=qmax=2.

    Am I missing something here? What's the catch? I don't have to mess with bitrates anymore, and I don't have to wait the extra time for a second pass. I just set my crop and video size, lock qmin=qmax=3, and let the encoder adjust as required to make a nice movie at any screen size. I suppose this isn't desirable if you have a target size in mind (like you want it to fit on a 700MB CD). But, for an iPod, this seems like a perfect fire-and-forget solution. I suppose I would have to spend a lot of time doing test-encodings and comparing PSNR values, but my pokey 1GHZ G4 will make that a painful process.

    Comments, anyone?
    - macr0t0r
    When did email start feeling like work?

  2. qmin=qmax=3 may work, but you may obtain insane bitrate peaks of very short duration which could be unplayable on the iPod or other devices. Test to know.

  3. I almost always use Xvid in single pass target quantizer mode with Q=2.

  4. Member
    Join Date
    Nov 2005
    Location
    United States
    Search Comp PM
    Ah, I see. This somehow seems backwards to me to specify a bitrate with quality caps. Wouldn't it be better to set a qulaity rating with a bitrate cap?

    Hmmmmm.....idea. iPod maxes at 2500kbps. So, what if I set the bitrate to 2300 (safety factor), qmin=3, and qmin=9. In theory, the "qmin=3" setting would force the bitrate down, but then the quality would still be allowed to slide for areas where 2300kbps were reached.

    Unfortunately, I can't find an app that gives me "peak" bitrate for a given video. It certainly would be useful right now.
    - macr0t0r
    When did email start feeling like work?

  5. Member
    Join Date
    Jun 2003
    Location
    United States
    Search Comp PM
    I've posted this in another ffmpegX thread:

    Use the "iPod h.264" setting. PAL seems to be okay as is NTSC so it appears not to be necessary to convert. 500-550kbps. 320 width by whatever is correct for the ratio (176 for 16:9, 240 for 4:3). QMin of 5, QMax of 30. If you're coming from AVI, use the "Decode with QuickTime" because some AVI's will result in video at 2X speed and using QT for the decode prevents this. Audio at 48000Hz, 96kb is okay if you're not pumping it over your home theater system.

    Why not use a lower QMin/QMax? File size will increase (perhaps dramatically). If you don't mind a 1.5GB video, go for it. However, you must be careful not to overpower the capacity of the iPod decoder chip. I've seen QMin of 2 produce files that are not only unplayable in the iPod but will crash iTunes if you attempt to rename the file once it's been dropped into the iPod.

    Why not use MPEG4 rather than H264? If you're willing to accept huge files, go for it. If, however, you believe that 2 hours of video should take no more than 500MB, then H264 will produce a better video at 320x than MPEG2 will at 480x at much higher bitrates.

    As the saying goes, YMMV and quality is subjective in this regard.

  6. Member
    Join Date
    Nov 2005
    Location
    United States
    Search Comp PM
    OK, did some experimenting. It appears that major is right (of course). However, my solution worked!

    OPTION A: Small video encoded with qmin=qmax=2 yielded video at average bitrate of 1700kbps.

    OPTION B: Same video encoded with qmin=qmax=3 yielded video at average bitrate of 1000kbps.

    OPTION C: Same video encoded with bitrate=2300 and q 2-9 yielded video at average bitrate of 1450kbps.

    OPTION D: Same video encoded with bitrate=2300 and q 3-9 yielded video at average bitrate of 980kbps.

    Notice the drop in the average when setting qmax to a larger value? This means that there HAD to be times that the bitrates in OPTION A and B went ABOVE 2300 when setting qmin=qmax. While encoding in the terminal for OPTION D, I would occasionally see a single frame drop to q=4 or q=5 during encoding. Nice info, major!

    So, there you have it folks. It IS possible to encode by specifying a quality and a bitrate "cap" of sorts.

    Since the framerate is 29.97, Option C is encoding at a similar bitrate as if I set Q=0.22. Not bad.

    ==Looks like Option C is the best for all future videos.==

    To summarize this:
    Variable bitrate is best because it packs more bits in complex scenes. Usually, we accomplish this thru dual-pass encoding, but that is quite time-consuming. By specifying a "cap" bitrate in the bitrate setting, then setting qmin=2, ffmpegx will continuously reduce the bitrate to a value that achieves the quality at that qmin (no matter what resolution). By setting qmax=9 (or larger) allows quality to slide for scenes that are so complex, that the assigned bitrate is actually achieved. This way, the bitrate does not rise above the iPod's capabilities.

    Understand that doing this is probably BETTER than dual-pass, since dual-pass purposefully packs more bits than the assigned bitrate in complex scenes. The second pass may inadvertenly pack more pits than the iPod can handle in those frames. OPTION C or D is probably safer while yielding very similar results and with the wait of dual-pass.

    Hoo man, I love FFMPEGX. Now if we could just fix that VOB-AAC bitrate bug!

    EDIT: in response to rumplestiltskin: Yep, it looks like you were trying to accomplish the same thing with the x264 codec. Notice that the x264 codec is more capable, thereby allowing a larger qmin for the same quality. However, try setting the bitrate at 740 or so while keeping qmax at 30. This will allow you to set qmin to 3 or 4 without exceeding the iPod bitrate capabilities. I have a hard time believeing any scene would be so complex that it would still exceed 740kbps at q=30.
    - macr0t0r
    When did email start feeling like work?

  7. Member
    Join Date
    Jun 2003
    Location
    United States
    Search Comp PM
    macr0t0r,

    I'll give your suggestion a try. Thanks for your efforts. Hope you got some sleep last night :P

    rumple




Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!