VideoHelp Forum




+ Reply to Thread
Results 1 to 13 of 13
  1. I'm frame serving an Avisynth script to handbrake. It's a 720x480 DV video with an aspect ratio of 4:3. How do I tell handbrake to keep this aspect ratio?
    Quote Quote  
  2. avisynth output always has a 1:1 PAR.
    -> you would need to overwrite the PAR (or whatever handbrake uses to express the aspect ration) for the source manually (no clue whether handbrake supports this, since I don't use handbrake)
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  3. You can't. Handbrake thinks it knows better than you. You can't even enter the sample aspect ratio in the x264 extra options field because the command you need to enter is "sar 10:11" but Handbrake uses the colon character to separate commands. So it doesn't pass the command correctly.

    You can resize to a 4:3 frame size in your AviSynth script and let Handbrake encode it as square pixel. Or remux and flag a display aspect ratio at the container level after encoding (and hope your playback device respects the flag). Or demux the h.264 video and use h264 AR Changer to specify the sample aspect ratio and remux with the audio. Or best of all, forget Handbrake and use the x264 or x265 CLI encoders directly.
    Last edited by jagabo; 20th Sep 2016 at 07:01.
    Quote Quote  
  4. Can you direct me to alternatives to handbrake that can do this? Preferably something as easy to use as Handbrake. Or can you provide me with the command line to use with x264 CLI encoder?

    Is it a good idea if I resize 720x480 to 640x480 in Avisynth/handbrake? Loss in resolution will not result in loss of quality?
    Last edited by digicube; 20th Sep 2016 at 09:59.
    Quote Quote  
  5. Originally Posted by jagabo View Post
    You can't. Handbrake thinks it knows better than you. You can't even enter the sample aspect ratio in the x264 extra options field because the command you need to enter is "sar 10:11" but Handbrake uses the colon character to separate commands. So it doesn't pass the command correctly.
    did you try "/" instead ? For example, ffmpeg which also uses colon to separate linear filter commands would use "-vf setsar=sar=10/11"
    Quote Quote  
  6. Originally Posted by poisondeathray View Post
    did you try "/" instead ?
    Yes, I tried that, and every other escape character I could think of.
    Last edited by jagabo; 20th Sep 2016 at 10:20.
    Quote Quote  
  7. Handbrake has a custom anamorphic option. I'm not sure why you couldn't use it.
    I don't have the latest Handbrake installed but there should be several custom anamorphic settings such as width, height, display width, and pixel width and height. For the Handbrake version I have it's not intuitive because changing one setting should effect another (ie changing the PAR should change the display width) but it doesn't work that way. I can't remember which settings take precedence but I'm fairly sure if you input the correct PAR and make sure the width, height and display width fields are all empty (or set to zero), it'll prevent Handbrake from resizing and it'll just set the specified pixel aspect ratio when encoding.

    For a 720x480 4:3 video, choosing "anamorphic custom" and setting "PAR width" to 10 and "PAR height" to 11 should do it, with the other fields empty or set to zero.

    Personally I'd just resize to square pixels. I very much doubt you'll see any loss of detail. I'm pretty sure the video would use an mpeg4 or ITU PAR (they're virtually identical) which is a PAR of 10:11, and.... 720x10/11=654.54 so resizing to 656x480 would be better than 640x480. That's a bit wider than 4:3 but it's supposed to be.

    Alternatively, you could use an Avisynth based GUI. For MeGUI you'd just load the script into the video section, configure the x264 encoder (if you check "show advanced settings" in the encoder configuration you can set the PAR under the Misc tab, although it's labelled SAR rather than PAR) then you'd click the queue button and switch to the job queue tab to run the encode. I assume you'll be processing and muxing the audio yourself?
    Last edited by hello_hello; 20th Sep 2016 at 15:32.
    Quote Quote  
  8. Originally Posted by hello_hello View Post
    Handbrake has a custom anamorphic option. I'm not sure why you couldn't use it... For a 720x480 4:3 video, setting "PAR width" to 10 and "PAR height" to 11 should do it.
    It doesn't work that way. The values don't make it to the video stream or the container. I think they are only used for Handbrake's resizing -- which is what I presume the OP wants to avoid. Otherwise he would just resize in AviSynth.
    Quote Quote  
  9. Originally Posted by jagabo View Post
    Originally Posted by hello_hello View Post
    Handbrake has a custom anamorphic option. I'm not sure why you couldn't use it... For a 720x480 4:3 video, setting "PAR width" to 10 and "PAR height" to 11 should do it.
    It doesn't work that way. The values don't make it to the video stream or the container. I think they are only used for Handbrake's resizing -- which is what I presume the OP wants to avoid. Otherwise he would just resize in AviSynth.
    It works for me. To make sure the specified PAR is used you need to either clear the width and height fields or clear the display width field or set it to zero. Or clear them all. I can't remember.... but clearing them all does the trick. If they aren't cleared I think they take precedence and then it gets fugly.... I've not worked out the pecking order for the anamorphic custom settings and I can't remember if they all work the way most rational people would expect.

    I just tested with a 704x384 AVI I had handy, so setting a PAR of 10:11 resulted in a 5:3 display aspect ratio, but it did work.
    From the Handbrake log file:

    [02:58:29] + Crop and Scale (704:384:0:0:0:0)
    [02:58:29] + source: 704 * 384, crop (0/0/0/0): 704 * 384, scale: 704 * 384
    [02:58:29] + custom anamorphic
    [02:58:29] + storage dimensions: 704 * 384, mod 2
    [02:58:29] + pixel aspect ratio: 10 / 11
    [02:58:29] + display dimensions: 640 * 384
    [02:58:29] + encoder: H.264 (x264)
    [02:58:29] + x264 preset: veryfast
    [02:58:29] + h264 profile: main
    [02:58:29] + h264 level: 4.0
    [02:58:29] + quality: 20.00 (RF)
    [02:58:29] * audio track 1
    [02:58:29] + decoder: Unknown (mp3) (2.0 ch) (track 1, id 0x1)
    [02:58:29] + bitrate: 160 kbps, samplerate: 48000 Hz
    [02:58:29] + mixdown: Stereo
    [02:58:29] + encoder: AAC (faac)
    [02:58:29] + bitrate: 160 kbps, samplerate: 48000 Hz
    [02:58:29] reader: first SCR 0 id 0x1 DTS 0
    [02:58:29] encx264: encoding with stored aspect 10/11
    [02:58:29] encx264: Encoding at constant RF 20.000000
    x264 [warning]: --psnr used with psy on: results will be invalid!
    x264 [warning]: --tune psnr should be used if attempting to benchmark psnr!
    x264 [info]: using SAR=10/11
    x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
    x264 [info]: profile Main, level 4.0

    I had the output set to MKV rather than MP4, just in case that makes a difference, although I'm not sure why it would. I'm using Handbrake 0.9.9.5530
    Last edited by hello_hello; 20th Sep 2016 at 12:36.
    Quote Quote  
  10. @hello I guess your method works. The video comes out be 720x480 (15:11), close enough to 4:3.

    If I don't use killaudio() in Avisynth script, i can see rainbow artifacts every few seconds. I think this is a well know problem of Avisynth.

    Image
    [Attachment 38602 - Click to enlarge]
    Last edited by digicube; 20th Sep 2016 at 15:20.
    Quote Quote  
  11. That's what it should be. The "official" re-size method for a 4:3 DVD is actually a little wider than 4:3 ie 704x480 = 4:3 not 720x480. The extra 8 pixels each side don't count (they're often just black). If you resize the whole 720 width it's therefore a little wider than 4:3.

    As far as I know 4:3 DV video follows the same standard, although if you want it to display as exactly 4:3, you can always use 8:9 for the PAR instead.
    Last edited by hello_hello; 20th Sep 2016 at 15:34.
    Quote Quote  
  12. Originally Posted by jagabo View Post
    Originally Posted by poisondeathray View Post
    did you try "/" instead ?
    Yes, I tried that, and every other escape character I could think of.
    https://handbrake.fr/docs/en/latest/cli/cli-guide.html

    I guess it's slightly different in handbrake but it looks like you should be able to use par_xar_y ; it should be the same as --sar x:y in x264 I think

    --custom-anamorphic Store pixel aspect ratio in video stream and
    directly control all parameters.

    --pixel-aspect <par_xar_y>
    Set pixel aspect for custom anamorphic
    (--display-width and --pixel-aspect are mutually
    exclusive.

    stoopid smileys are invading my post haha
    Quote Quote  
  13. Originally Posted by hello_hello View Post
    Originally Posted by jagabo View Post
    Originally Posted by hello_hello View Post
    Handbrake has a custom anamorphic option. I'm not sure why you couldn't use it... For a 720x480 4:3 video, setting "PAR width" to 10 and "PAR height" to 11 should do it.
    It doesn't work that way. The values don't make it to the video stream or the container. I think they are only used for Handbrake's resizing -- which is what I presume the OP wants to avoid. Otherwise he would just resize in AviSynth.
    It works for me. To make sure the specified PAR is used you need to either clear the width and height fields or clear the display width field or set it to zero. Or clear them all. I can't remember.... but clearing them all does the trick. If they aren't cleared I think they take precedence and then it gets fugly....
    You're right. If you set Display Width to 0 -- PAR Width and PAR Height are used to calculate the display aspect ratio. Otherwise Display Width is used and PAR Width and PAR Height are ignored.
    Quote Quote  



Similar Threads

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