2D-FIR Scaling

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.

*******************************
LonestarOrison
Posts: 46
Joined: Fri Jul 23, 2010 2:17 am

2D-FIR Scaling

Post by LonestarOrison »

Would it be possible to make HandBrake use a 2D-FIR scaler instead of the Bicubic one? I've been doing some encoding with MPEG Streamclip and the output files from that look really great. Gradients are smooth and grainy rather than blocky, for example. I THINK that has to do with the scaler it's using, anyway. Anyway, I'll restate my question above, would it be possible to use 2D-FIR scaling?
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: 2D-FIR Scaling

Post by JohnAStebbins »

HandBrake doesn't use bicubic. It uses Lanczos. Lanczos is a windowed resampling method that takes the infinite impulse response SINC filter and turns it into an FIR filter. It may not be the garden variety fir you had in mind, but it is a 2d-fir.

My guess would be that the blockiness you see is coming from the encoder settings you are using and not the scaler.
LonestarOrison
Posts: 46
Joined: Fri Jul 23, 2010 2:17 am

Re: 2D-FIR Scaling

Post by LonestarOrison »

Huh. Well, regardless, I get much nicer video output with Streamclip than I do with HandBrake. Better handling of high-motion, too. Oh well, I guess I'll just have to stick to encoding with MPEG Streamclip and muxing output video with chapters and AC3 from HandBrake with QT Pro.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: 2D-FIR Scaling

Post by jbrjake »

Or, you know, you could start a support thread and provide some logs of what you're doing and perhaps a source sample, so maybe we could see why you're having issues....What does "better handling of high-motion" even mean?
LonestarOrison
Posts: 46
Joined: Fri Jul 23, 2010 2:17 am

Re: 2D-FIR Scaling

Post by LonestarOrison »

I mean it somehow deals with sequences that would require a high bitrate to look good, better than HandBrake does. Shots with lots of moving water, for example, produce less artifacts with MPEG Streamclip than with HandBrake. I'm not saying this is related to the scaling method, but rather the encoder.

And as for providing source samples, I would assume encoding commercial DVDs is illegal, let alone providing samples of them online. So I'll stick to what I'm doing now. Even if I could get the same image quality as Streamclip, I doubt the file size would decrease. What I'm also concerned with is that for a 40 minute TV show with Baseline@L3.0, I get a file size of about 480MB. With Streamclip, I get a better image quality and also 460MB. Streamclip, also encoding Baseline@L3.0 (both according to MediaInfo).
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: 2D-FIR Scaling

Post by JohnAStebbins »

And still no activity log so we can't help diagnose if you are doing anything wrong...
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: 2D-FIR Scaling

Post by jbrjake »

...and considering how terrible the QT encoder StreamClip (by default) uses is at both compression and retaining visual quality, you almost certainly are doing something wrong in HB. So, again, log?

Providing a very short, insubstantial sample of the source, like under 30 seconds, seems like pretty clear fair use to me.
LonestarOrison
Posts: 46
Joined: Fri Jul 23, 2010 2:17 am

Re: 2D-FIR Scaling

Post by LonestarOrison »

OK, so I encoded an episode with what I would assume would give me the best picture quality, and what I came out with was a 486MB file from HandBrake, as opposed to a 478MB file from HandBrake (with the settings I was using previously). The settings I'm using is a modified version of the iPod Legacy preset. For the smaller file size, I change only the frame size to anamorphic (encoded pixels within 640x480), and enabling 2pass. When trying to maintain the best possible picture quality, I used the following (from MediaInfo):

Code: Select all

cabac=0 / ref=1 / deblock=1:0:0 / analyse=0x1:0x131 / me=tesa / subme=9 / psy=1 / psy_rd=0.0:0.0 / mixed_ref=0 / me_range=64 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / chroma_qp_offset=0 / threads=3 / nr=0 / decimate=1 / mbaff=0 / constrained_intra=0 / bframes=0 / wpredp=0 / keyint=250 / keyint_min=25 / scenecut=40 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=1500 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=1500 / vbv_bufsize=2000 / ip_ratio=1.40 / aq=1:1.00
Here is a comparison of the two outputs. In both images, HandBrake is on the top, and MPEG Streamclip is on the bottom. Notice the difference in grain and blocky artifacts:
Note - it seems that the cropping techniques differ, so there may be a slight difference in that respect, but rest assured both images are of the same frame.

Image Image

Log:

Code: Select all

### CLI Query:  -i "F:\DVDs\Desperate Housewives\Season 1\Disc 1" -t 1 --angle 1 -c 1-9 -o "C:\Users\Josh\Videos\Handbrake\Disc 1-1.m4v" -f mp4 -I  -X 640 -l 480 --crop 0:4:2:2 --custom-anamorphic  --pixel-aspect 853:640  --decomb -e x264 -b 1500 -2  -a 1 -E faac -6 auto -R 44.1 -B 160 -D 0 --markers="C:\Users\Josh\AppData\Local\Temp\Disc 1-1-1-chapters.csv" -x level=30:bframes=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=tesa:no-fast-pskip=1:psy-rd=0,0:subq=9:8x8dct=0:trellis=0:weightb=0:mixed-refs=1:merange=64 -v 2

### User Query: False

#########################################

[23:14:31] hb_init: checking cpu count
[23:14:31] hb_init: starting libhb thread
HandBrake 0.9.4 (2009112300) - MinGW i386 - http://handbrake.fr
2 CPUs detected
Opening F:\DVDs\Desperate Housewives\Season 1\Disc 1...
[23:14:31] hb_scan: path=F:\DVDs\Desperate Housewives\Season 1\Disc 1, title_index=1
[23:14:31] scan: trying to open with libdvdread
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Encrypted DVD support unavailable.
libdvdread: Device (null) inaccessible, CSS authentication not available.
NAME OPEN FAILED
libdvdnav: Unable to find home directorylibdvdnav: DVD disk reports itself with Region mask 0x00000000. Regions: 1 2 3 4 5 6 7 8
libdvdread: Encrypted DVD support unavailable.
libdvdread: Device (null) inaccessible, CSS authentication not available.
[23:14:31] scan: DVD has 28 title(s)
[23:14:31] scan: scanning title 1
[23:14:31] scan: opening IFO for VTS 1
[23:14:31] pgc_id: 1, pgn: 1: pgc: 0x1886190
[23:14:31] scan: vts=1, ttn=1, cells=0->8, blocks=179->783651, 781846 blocks
[23:14:31] scan: duration is 00:41:36 (2496010 ms)
[23:14:31] scan: checking audio 1
[23:14:31] scan: id=80bd, lang=English (AC3), 3cc=eng ext=0
[23:14:31] scan: checking audio 2
[23:14:31] scan: id=81bd, lang=English (AC3) (Director's Commentary 1), 3cc=eng ext=3
[23:14:31] scan: checking subtitle 1
[23:14:31] scan: id=20bd, lang=English, 3cc=eng
[23:14:31] scan: checking subtitle 2
[23:14:31] scan: id=21bd, lang=English (Closed Caption), 3cc=eng
[23:14:31] scan: checking subtitle 3
[23:14:31] scan: id=22bd, lang=Norsk, 3cc=nor
[23:14:31] scan: checking subtitle 4
[23:14:31] scan: id=23bd, lang=Norsk (Director's Commentary), 3cc=nor
[23:14:31] scan: title 1 has 9 chapters
[23:14:31] scan: chap 1 c=0->0, b=179->52763 (52585), 148228 ms
[23:14:31] scan: chap 2 c=1->1, b=52764->54755 (1992), 3334 ms
[23:14:31] scan: chap 3 c=2->2, b=54756->275125 (220370), 649994 ms
[23:14:31] scan: chap 4 c=3->3, b=275126->402447 (127322), 427841 ms
[23:14:31] scan: chap 5 c=4->4, b=402448->547892 (145445), 477691 ms
[23:14:31] scan: chap 6 c=5->5, b=547893->652574 (104682), 351864 ms
[23:14:31] scan: chap 7 c=6->6, b=652575->778229 (125655), 404819 ms
[23:14:31] scan: chap 8 c=7->7, b=778230->781845 (3616), 32145 ms
[23:14:31] scan: chap 9 c=8->8, b=783473->783651 (179), 90 ms
[23:14:31] scan: aspect = 0
[23:14:31] scan: decoding previews for title 1
[23:14:31] scan: title angle(s) 1
[23:14:31] scan: audio 0x80bd: AC-3, rate=48000Hz, bitrate=384000 English (AC3) (5.1 ch)
[23:14:31] scan: audio 0x81bd: AC-3, rate=48000Hz, bitrate=96000 English (AC3) (Director's Commentary 1) (1.0 ch)
[23:14:31] scan: 10 previews, 720x576, 25.000 fps, autocrop = 0/4/0/0, aspect 16:9, PAR 64:45
[23:14:31] scan: title (0) job->width:720, job->height:400
[23:14:31] libhb: scan thread found 1 valid title(s)
+ title 1:
  + vts 1, ttn 1, cells 0->8 (781846 blocks)
  + angle(s) 1
  + duration: 00:41:36
  + size: 720x576, pixel aspect: 64/45, display aspect: 1.78, 25.000 fps
  + autocrop: 0/4/0/0
  + chapters:
    + 1: cells 0->0, 52585 blocks, duration 00:02:28
    + 2: cells 1->1, 1992 blocks, duration 00:00:03
    + 3: cells 2->2, 220370 blocks, duration 00:10:50
    + 4: cells 3->3, 127322 blocks, duration 00:07:08
    + 5: cells 4->4, 145445 blocks, duration 00:07:58
    + 6: cells 5->5, 104682 blocks, duration 00:05:52
    + 7: cells 6->6, 125655 blocks, duration 00:06:45
    + 8: cells 7->7, 3616 blocks, duration 00:00:32
    + 9: cells 8->8, 179 blocks, duration 00:00:00
  + audio tracks:
    + 1, English (AC3) (5.1 ch) (iso639-2: eng), 48000Hz, 384000bps
    + 2, English (AC3) (Director's Commentary 1) (1.0 ch) (iso639-2: eng), 48000Hz, 96000bps
  + subtitle tracks:
    + 1, English (iso639-2: eng) (Bitmap)
    + 2, English (Closed Caption) (iso639-2: eng) (Bitmap)
    + 3, Norsk (iso639-2: nor) (Bitmap)
    + 4, Norsk (Director's Commentary) (iso639-2: nor) (Bitmap)
Reading chapter markers from file C:\Users\Josh\AppData\Local\Temp\Disc 1-1-1-chapters.csv
[23:14:31] 2 job(s) to process
[23:14:31] starting job
[23:14:31] work: sanitizing track 0 mixdown Mono to Stereo
[23:14:31] job configuration:
[23:14:31]  * source
[23:14:31]    + F:\DVDs\Desperate Housewives\Season 1\Disc 1
[23:14:31]    + title 1, chapter(s) 1 to 9
[23:14:31]  * destination
[23:14:31]    + C:\Users\Josh\Videos\Handbrake\Disc 1-1.m4v
[23:14:31]    + container: MPEG-4 (.mp4 and .m4v)
[23:14:31]      + compatibility atom for iPod 5G
[23:14:31]      + chapter markers
[23:14:31]  * video track
[23:14:31]    + decoder: mpeg2
[23:14:31]      + bitrate 9800 kbps
[23:14:31]    + frame rate: same as source (around 25.000 fps)
[23:14:31]    + custom anamorphic
[23:14:31]      + modulus: 0
[23:14:31]      + storage dimensions: 720 * 576 -> 640 * 480, crop 0/4/2/2
[23:14:31]      + pixel aspect ratio: 853 / 640
[23:14:31]      + display dimensions: 853 * 480
[23:14:31]    + filter
[23:14:31]      + Decomb (default settings)
[23:14:31]    + encoder: x264
[23:14:31]      + options: level=30:bframes=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=tesa:no-fast-pskip=1:psy-rd=0,0:subq=9:8x8dct=0:trellis=0:weightb=0:mixed-refs=1:merange=64
[23:14:31]      + bitrate: 1500 kbps, pass: 1
[23:14:31]  * audio track 0
[23:14:31]    + decoder: English (AC3) (5.1 ch) (track 1, id 80bd)
[23:14:31]      + bitrate: 384 kbps, samplerate: 48000 Hz
[23:14:31]    + mixdown: Stereo
[23:14:31]    + encoder: faac
[23:14:31]      + bitrate: 160 kbps, samplerate: 44100 Hz
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Encrypted DVD support unavailable.
libdvdread: Device (null) inaccessible, CSS authentication not available.
NAME OPEN FAILED
libdvdnav: Unable to find home directorylibdvdnav: DVD disk reports itself with Region mask 0x00000000. Regions: 1 2 3 4 5 6 7 8
libdvdread: Encrypted DVD support unavailable.
libdvdread: Device (null) inaccessible, CSS authentication not available.
[23:14:31] yadif thread started for segment 0
[23:14:31] decomb thread started for segment 0
[23:14:31] encx264: encoding with stored aspect 853/640
x264 [info]: using SAR=853/640
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[23:14:31] yadif thread started for segment 1
[23:14:31] decomb thread started for segment 1
[23:14:31] reader: first SCR 146 id 224 DTS 22254
[23:14:31] mpeg2: "Chapter 1" (1) at frame 0 time 3600
x264 [info]: profile Baseline, level 3.0
No accelerated IMDCT transform found
[23:14:31] sync: expecting 62425 video frames
[23:14:31] sync: first pts is 3600
[23:25:31] mpeg2: "Chapter 2" (2) at frame 3720 time 13395600
[23:25:47] mpeg2: "Chapter 3" (3) at frame 3813 time 13730400
[00:15:53] mpeg2: "Chapter 4" (4) at frame 20040 time 72147600
[00:46:25] mpeg2: "Chapter 5" (5) at frame 30721 time 110599200
[01:21:20] mpeg2: "Chapter 6" (6) at frame 42666 time 153601200
[01:47:21] mpeg2: "Chapter 7" (7) at frame 51460 time 185259600
[02:17:52] mpeg2: "Chapter 8" (8) at frame 61578 time 221684400
[02:18:15] reader: done. 1 scr changes
[02:18:16] mpeg2: "Chapter 9" (9) at frame 62398 time 224636400
[02:18:16] sync: got 62409 frames, 62425 expected
[02:18:16] work: average encoding speed for job is 5.657527 fps
[02:18:23] mpeg2 done: 62410 frames
[02:18:23] render: lost time: 0 (0 frames)
[02:18:23] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: frame I:872   Avg QP:16.82  size: 35928  PSNR Mean Y:47.77 U:49.96 V:50.68 Avg:48.33 Global:45.70
x264 [info]: frame P:61536 Avg QP:20.26  size:  6989  PSNR Mean Y:44.39 U:46.93 V:47.64 Avg:45.03 Global:43.18
x264 [info]: mb I  I16..4: 27.6%  0.0% 72.4%
x264 [info]: mb P  I16..4:  6.0%  0.0%  3.9%  P16..4: 44.0% 22.2%  4.8%  0.6%  0.2%    skip:18.3%
x264 [info]: coded y,uvDC,uvAC intra: 47.9% 60.9% 27.5% inter: 25.3% 24.5% 1.8%
x264 [info]: i16 v,h,dc,p: 46% 15% 14% 25%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 13% 22%  6%  7%  9%  6%  7%  4%
x264 [info]: SSIM Mean Y:0.9807417
x264 [info]: PSNR Mean Y:44.433 U:46.973 V:47.687 Avg:45.080 Global:43.203 kb/s:1478.76
[02:18:23] decomb: deinterlaced 0 | blended 0 | unfiltered 62408 | total 62408
[02:18:23] starting job
[02:18:23] work: sanitizing track 0 mixdown Mono to Stereo
[02:18:23] job configuration:
[02:18:23]  * source
[02:18:23]    + F:\DVDs\Desperate Housewives\Season 1\Disc 1
[02:18:23]    + title 1, chapter(s) 1 to 9
[02:18:23]  * destination
[02:18:23]    + C:\Users\Josh\Videos\Handbrake\Disc 1-1.m4v
[02:18:23]    + container: MPEG-4 (.mp4 and .m4v)
[02:18:23]      + compatibility atom for iPod 5G
[02:18:23]      + chapter markers
[02:18:23]  * video track
[02:18:23]    + decoder: mpeg2
[02:18:23]      + bitrate 9800 kbps
[02:18:23]    + frame rate: same as source (around 25.000 fps)
[02:18:23]    + custom anamorphic
[02:18:23]      + modulus: 0
[02:18:23]      + storage dimensions: 720 * 576 -> 640 * 480, crop 0/4/2/2
[02:18:23]      + pixel aspect ratio: 853 / 640
[02:18:23]      + display dimensions: 853 * 480
[02:18:23]    + filter
[02:18:23]      + Decomb (default settings)
[02:18:23]    + encoder: x264
[02:18:23]      + options: level=30:bframes=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=tesa:no-fast-pskip=1:psy-rd=0,0:subq=9:8x8dct=0:trellis=0:weightb=0:mixed-refs=1:merange=64
[02:18:23]      + bitrate: 1500 kbps, pass: 2
[02:18:23]  * audio track 0
[02:18:23]    + decoder: English (AC3) (5.1 ch) (track 1, id 80bd)
[02:18:23]      + bitrate: 384 kbps, samplerate: 48000 Hz
[02:18:23]    + mixdown: Stereo
[02:18:23]    + encoder: faac
[02:18:23]      + bitrate: 160 kbps, samplerate: 44100 Hz
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Encrypted DVD support unavailable.
libdvdread: Device (null) inaccessible, CSS authentication not available.
NAME OPEN FAILED
libdvdnav: Unable to find home directorylibdvdnav: DVD disk reports itself with Region mask 0x00000000. Regions: 1 2 3 4 5 6 7 8
[02:18:23] yadif thread started for segment 0
[02:18:23] yadif thread started for segment 1
[02:18:23] decomb thread started for segment 0
[02:18:23] encx264: encoding with stored aspect 853/640
x264 [info]: using SAR=853/640
[02:18:23] decomb thread started for segment 1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
libdvdread: Encrypted DVD support unavailable.
libdvdread: Device (null) inaccessible, CSS authentication not available.
[02:18:23] reader: first SCR 146 id 224 DTS 22254
[02:18:23] mpeg2: "Chapter 1" (1) at frame 0 time 3600
x264 [warning]: target: 1500.00 kbit/s, expected: 1479.42 kbit/s, avg QP: 24.1494
x264 [info]: profile Baseline, level 3.0
No accelerated IMDCT transform found
[02:18:33] sync: expecting 62409 video frames
[02:18:33] sync: first pts is 3600
[02:29:27] mpeg2: "Chapter 2" (2) at frame 3720 time 13395600
[02:29:40] mpeg2: "Chapter 3" (3) at frame 3813 time 13730400
[03:19:06] mpeg2: "Chapter 4" (4) at frame 20040 time 72147600
[03:48:38] mpeg2: "Chapter 5" (5) at frame 30721 time 110599200
[04:22:33] mpeg2: "Chapter 6" (6) at frame 42666 time 153601200
[04:47:51] mpeg2: "Chapter 7" (7) at frame 51460 time 185259600
[05:17:24] mpeg2: "Chapter 8" (8) at frame 61578 time 221684400
[05:17:38] reader: done. 1 scr changes
[05:17:38] mpeg2: "Chapter 9" (9) at frame 62398 time 224636400
[05:17:42] sync: got 62409 frames, 62409 expected
[05:17:42] work: average encoding speed for job is 5.806150 fps
[05:17:45] mux: track 0, 62408 frames, 461628827 bytes, 1479.39 kbps, fifo 16
[05:17:45] mux: track 1, 107482 frames, 47380333 bytes, 151.84 kbps, fifo 512
[05:17:45] mpeg2 done: 62410 frames
[05:17:45] render: lost time: 0 (0 frames)
[05:17:45] render: gained time: 0 (0 frames) (0 not accounted for)
x264 [info]: frame I:872   Avg QP:17.80  size: 31591  PSNR Mean Y:47.05 U:49.47 V:50.21 Avg:47.64 Global:45.14
x264 [info]: frame P:61536 Avg QP:20.39  size:  7055  PSNR Mean Y:44.38 U:46.95 V:47.66 Avg:45.03 Global:43.23
x264 [info]: mb I  I16..4: 28.7%  0.0% 71.3%
x264 [info]: mb P  I16..4:  5.9%  0.0%  3.9%  P16..4: 43.9% 22.0%  4.8%  0.6%  0.2%    skip:18.7%
x264 [info]: coded y,uvDC,uvAC intra: 48.3% 61.2% 27.2% inter: 25.4% 24.7% 1.9%
x264 [info]: i16 v,h,dc,p: 46% 15% 14% 25%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 13% 22%  6%  7%  9%  6%  7%  4%
x264 [info]: SSIM Mean Y:0.9809078
x264 [info]: PSNR Mean Y:44.417 U:46.981 V:47.691 Avg:45.064 Global:43.255 kb/s:1479.48
[05:17:45] decomb: deinterlaced 0 | blended 0 | unfiltered 62408 | total 62408
[05:17:45] libhb: work result = 0

Rip done!
HandBrake has exited.

And if a moderator wants to move the topic then feel free...
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

Re: 2D-FIR Scaling

Post by JohnAStebbins »

Good lord man, iPod Legacy? Seriously? There's a reason it's legacy. If you don't have any particular device constraints, you should be starting out with the Normal or High Profile presets. If you do have device constraints, you should start with one of the more recent device oriented presets.
mac_man_ad
Experienced
Posts: 75
Joined: Wed Aug 22, 2007 5:21 am

Re: 2D-FIR Scaling

Post by mac_man_ad »

Also, why tesa me? and 64px merange? 32 and umh is fine for all but very weird sources
LonestarOrison
Posts: 46
Joined: Fri Jul 23, 2010 2:17 am

Re: 2D-FIR Scaling

Post by LonestarOrison »

The recent iPod preset and the iPod Legacy preset have exactly the same advanced settings, the only difference is the bitrate and the resolution. And I do have device constraints, but I'd rather not have to encode twice, so I use the maximum resolution I can while still maintaining device compatibility.

As for asking why I used those particular advanced settings, I used them because I wanted to get the maximum possible picture quality without affecting the output profile level. By no means should you assume that I encode all my videos to that setting, I just wanted to see if HandBrake could match the picture quality of MPEG Streamclip (who's settings are unknown due to the different encoder, and what I can extract from MediaInfo is not useful, besides the 1 reference frame). And as shown in the example, not only could it not get the same quality, but also the file size was larger (20MB for a 40min episode).

And let me restate that according to MediaInfo, both are baseline level 3.0.
mac_man_ad
Experienced
Posts: 75
Joined: Wed Aug 22, 2007 5:21 am

Re: 2D-FIR Scaling

Post by mac_man_ad »

Current Ipod preset does not have me=tesa in it. It has me=umh. Also, both use subme=6, not 9. Hence, you have changed something somewhere.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: 2D-FIR Scaling

Post by jbrjake »

LonestarOrison wrote:And I do have device constraints, but I'd rather not have to encode twice, so I use the maximum resolution I can while still maintaining device compatibility.
Did I miss where you said what your device constraints actually are?

The settings you are currently using are ridiculous and it is disingenuous of you to claim HandBrake produces bad output when you've already smashed it in the kneecaps. Garbage In, Garbage Out.

And what is with the anamorphic setting? That *certainly* isn't in the preset. Taking a 720*576 source, scaling it down to 640*480, and displaying it at 854*480 while only giving it 1500kb/s is a recipe for bad looking encodes. Really, what did you expect? And how can you justify it as saving space when all you're doing is lowering quality by forcing HB to spread the same number of bits between *more* pixels than it would have chosen to itself?
jamiemlaw
Veteran User
Posts: 536
Joined: Thu Sep 17, 2009 4:52 pm

Re: 2D-FIR Scaling

Post by jamiemlaw »

Reading between the lines here, I assume that the original post should have gone something like this:
I'm currently using Apple's QT encoder to convert my videos to a format I can view on my iPod classic, as well as my computer. I've tried mimicking Apple's iPod preset in HandBrake but the results aren't as good, even if I max out the all the settings that I know won't increase the profile level (see screenshots and logs). It seems that to reach the same perceivable quality as QT, I'd need to use up to double the bitrate. Do not want. Please advise.

Lots of love

LonestarOcean xxx
I once tried mimicking Apple's AppleTV preset in HandBrake. From what I recall, QT was very good at handling grain and movement. I ran the results of a QT and HandBrake encode through JES Movie Tools, comparing them to the original, and while HB was (slightly) better on parts of the image that weren't moving, QT was noticeably better with the parts that were (including grain).
Last edited by jamiemlaw on Fri Sep 10, 2010 2:21 pm, edited 1 time in total.
Deleted User 11865

Re: 2D-FIR Scaling

Post by Deleted User 11865 »

Note: only the iPod 5/5.5G require the iPod legacy preset. The iPod classic (i.e. 6G) should work fine with the Universal preset.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: 2D-FIR Scaling

Post by jbrjake »

jamiemlaw, I'm very skeptical. QT's H.264 encoder isn't known to be better with anything, including grain and movement. See, for example, MSU''s 3rd video codec shootout, where they tried to include Apple's encoder:
Conclusions
MOSCOW, NOV 2006
• Codecs from Apple and Sorenson show average quality compared with other codecs and are not leaders in their spheres.
• Codec from Apple shows low quality on some types of sequences («Movies») when it is evaluated using measures like Y-PSNR; this is explained by brightness shift introduced by this codec. Yet using objective metric that is independent to brightness shifts (MSU BI- PSNR), quality of codec from Apple becomes comparable with others – see Figure 23 and Figure 24.
• Thus with inclusion of codecs from Apple and Sorenson leading positions of x264 codec and codec from MainConcept remains unshakable.
http://compression.ru/video/codec_compa ... 06_en.html

Not to mention, x264 has improved by leaps and bounds since then (psy-aq, mbtree), and Apple's encoder has remained static as far as anyone can tell.

Also, the OP is most definitely *not* "mimicking Apple's iPod preset in HandBrake." Go try to export a video from QT using its iPod preset. You will get output that has a max width of 640 pixels with a 1:1 pixel aspect ratio. As in, 640*360, not the OP's ridiculous 640*480 stretched to 854*480.
LonestarOrison
Posts: 46
Joined: Fri Jul 23, 2010 2:17 am

Re: 2D-FIR Scaling

Post by LonestarOrison »

No, I am not mimicking the Apple iPod Preset in HandBrake, I am mimicking the settings that Apple uses when encoding movies for the iTunes Store, or at least trying to. The problem is that I don't know how to do so to achieve the best results (not considering encoding time), so I assumed that the highest settings would yield the best results (while still using Baseline@L3.0). And on that note, if the resolution is so ridiculous, then how come it is handled so well in not only MPEG Streamclip, but also the iTunes Store downloads? Certainly HandBrake is missing something here, or I am doing something wrong in the settings. If x264 is indeed a better encoder, then certainly with the right settings it should come out with a better image quality in gradients and high motion sequences.

And I never said that I am *using* the iPod Preset in HandBrake, just that I am using a modified version of it. I stated the differences in a previous post.

Also it might be useful to note that MPEG Streamclip and QT Pro produce different outputs when given the same input file. QT Pro tends to output bigger file sizes with worse quality, whereas MPEG Streamclip outputs smaller file sizes with better quality. Perhaps this has to do with MPEG Streamclip passing the video 4 times (including the encoding pass). This of course results in ridiculously long encoding times, but if I get a better file, then that doesn't matter to me.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: 2D-FIR Scaling

Post by jbrjake »

...and still waiting for you to share what device it is you're encoding for. This isn't an idle question, the answer will tell us what is and is not necessary in your encoding options.

You haven't shared a sample of the source, as was requested, so it's not like anyone can try to reproduce what you're doing in StreamClip, either. All you've shown us is a display rez screenshot. Does StreamClip even *do* anamorphic? If not, you're comparing apples to oranges--of course rendering 720*576 -> 1024*576 then scaling down to 853*480 and encoding is going to look better than scaling 720*576 to 640*480 and encoding and then rendering at 853*480.

Why are you mimicking Apple's iTunes store encodes? Do you have access to studio masters the way they do?
LonestarOrison
Posts: 46
Joined: Fri Jul 23, 2010 2:17 am

Re: 2D-FIR Scaling

Post by LonestarOrison »

I was originally encoding for iPod Classic, but I have since then decided against that because it's rare that my friend would want to borrow a movie anyway. So, now I am encoding for iPhone 3GS. I'm aware that the max resolution for iPhone is 720x576, so I'd like to encode at that resolution (anamorphic of course) at 2500 kbps, multipass, main profile level 3.0. I have compared outputs of both MPEG Streamclip and HandBrake while encoding at this level, and the difference in picture quality is barely perceptible. I haven't yet tested for file size because the settings you recommend could well change that. For now, I'm going to assume that MPEG Streamclip is a much better baseline encoder, but let's not argue about that anymore.

MPEG Streamclip does not do anamorphic, but I was changing the display resolution in QT Pro after encoding. And I don't think providing a sample of the source is necessary, because you could try it with any DVD and get the same results.

EDIT: Note that encoding time is not an issue for me.
Deleted User 11865

Re: 2D-FIR Scaling

Post by Deleted User 11865 »

LonestarOrison wrote:I was originally encoding for iPod Classic, but I have since then decided against that because it's rare that my friend would want to borrow a movie anyway. So, now I am encoding for iPhone 3GS.
iPod classic can be several devices. The settings you are/were using are crippled for compatibility with the 5G and 5.5G iPod classic - many of the limiting settings aren't necessary for a 6G classic. Not to mention 6G classics support 720x480 resolution.
LonestarOrison wrote:I'm aware that the max resolution for iPhone is 720x576, so I'd like to encode at that resolution (anamorphic of course) at 2500 kbps, multipass, main profile level 3.0. I have compared outputs of both MPEG Streamclip and HandBrake while encoding at this level, and the difference in picture quality is barely perceptible.
You are/were not encoding Main Profile with your HandBrake/x264 settings. Also, the iPhone 3GS supports High Profile. Apple's encoder can't encode High Profile, but since the 3GS and newer iPhones support it, there's no reason to not use High Profile in HandBrake.

Also, 720x576 up to 25 fps, for 30 fps sources, you're limited to 720x480, IIRC.
LonestarOrison
Posts: 46
Joined: Fri Jul 23, 2010 2:17 am

Re: 2D-FIR Scaling

Post by LonestarOrison »

I see. Doesn't ATV struggle with High Profile though? Anyway, so if you could recommend some advanced settings, please? Or should I just use the ATV preset for compatibility with both my iPhone and my ATV? Because, I was wondering, if the encoding speed was taken into account when designing the presets. If not, then I'd be inclined to just the the ATV preset. Otherwise, I'd rather use optimal picture quality settings.
mac_man_ad
Experienced
Posts: 75
Joined: Wed Aug 22, 2007 5:21 am

Re: 2D-FIR Scaling

Post by mac_man_ad »

Try Apple Universal preset...
Deleted User 11865

Re: 2D-FIR Scaling

Post by Deleted User 11865 »

So you're targeting both AppleTV and iPhone 3GS compatibility, I see. Aside from the resolution limit (which is artificially imposed by iTunes), the more capable device is definitely the iPhone 3GS.

You could try either the AppleTV preset or dynaflash's ATV preset. You could also use slower settings based on either of the two presets.

Edit - try one of the following set of settings (from slowest to fastest):

Code: Select all

weightp=0:b-pyramid=none:vbv-maxrate=5500:vbv-bufsize=5500:b-adapt=2:direct=auto:me=umh:subq=9:rc-lookahead=60:analyse=all:trellis=2:bframes=4

Code: Select all

weightp=0:b-pyramid=none:vbv-maxrate=5500:vbv-bufsize=5500:b-adapt=2:direct=auto:me=umh:subq=8:rc-lookahead=50

Code: Select all

weightp=0:b-pyramid=none:vbv-maxrate=5500:vbv-bufsize=5500:b-adapt=2:subq=8

Code: Select all

weightp=0:b-pyramid=none:vbv-maxrate=5500:vbv-bufsize=5500:b-adapt=2

Code: Select all

weightp=0:b-pyramid=none:vbv-maxrate=5500:vbv-bufsize=5500:b-adapt=2:trellis=0

Code: Select all

weightp=0:b-pyramid=none:vbv-maxrate=5500:vbv-bufsize=5500:trellis=0
The AppleTV plays High Profile fine, it mostly struggles with CABAC (and supports neither b-pyramid nor weightp). The vbv settings should take care of the AppleTV's CABAC weakness, though very rarely, the encodes may still stutter - in which case you can either reduce the bufsize and maxrate, or use a value of 9500 for both and disable CABAC like in the official preset.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: 2D-FIR Scaling

Post by jbrjake »

LonestarOrison wrote:MPEG Streamclip does not do anamorphic, but I was changing the display resolution in QT Pro after encoding.
That still doesn't give enough information to reproduce what you're doing. Exactly which options do you have set in Streamclip's export window?
And I don't think providing a sample of the source is necessary, because you could try it with any DVD and get the same results.
No, I cannot get the same results without your source. You're complaining about content specific problems -- rippling water and gradients in particular, and to top it off you're focusing on motion issues. If my gradients aren't sloped the same or my water is shot from a different angle or the camera in my sample moves at a different speed, it's not going to produce the same artifacts, now is it? If I didn't think it was necessary I would not be repeatedly asking you for it.
LonestarOrison
Posts: 46
Joined: Fri Jul 23, 2010 2:17 am

Re: 2D-FIR Scaling

Post by LonestarOrison »

High motion sample: http://www.mediafire.com/file/b9310llph ... Motion.mpg

Grain/Gradient sample: http://www.mediafire.com/file/39uu39n5m80eg7q/Grain.mpg

I extracted those with MPEG Streamclip, and have tested them in HandBrake. They work fine. What I want you want to test is the baseline output of each encoder. What is more important to me is the perceived quality, rather than the file size. Encoding time does not factor in my preferences. So far, in all the tests that I've done, Streamclip has come out on top in both file size and quality. But as it is the simpler encoder, I really don't know how to get the best quality/file size out of x264.

If you manage to figure out settings that will do better than Streamclip, then be sure to post them.

Note that the things I want to keep constant in both encoders are: 640x480 resolution, multipass, 1500kbps (regardless of whether or not you claim these settings to be "ridiculous").

For Streamclip, on both sources you will have to determine cropping values yourself, but you can just use the values from HandBrake's automatic cropper. The settings I used in Streamclip are: multipass (literally no other checkbox should to be filled in, besides 'limit data rate' of course).
Post Reply