Automatic Cropping, eg for Android

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
linuxuser
Bright Spark User
Posts: 208
Joined: Fri Jan 06, 2012 7:47 pm

Automatic Cropping, eg for Android

Post by linuxuser »

Many Android mobile phones have a resolution of 480x320 and unfortunately the only Android opensource player I found, which plays Handbrake files, the Dolphin player - http://code.google.com/p/dolphin-player/ is a little bit buggy. If the video doesn't have the full resolution of the display, eg with 16:9 movies, it "doubles" the video into the black bars. So the solution is to crop the video to exactly 480x320. This can be done manually of course, but it would be nice to have it done automatically for every source dimension by cropping symmetrically. This automatic cropping would also ne nice with 4:3 movies to 16:9. But it can be a little bit complex, because first automatic cropping must be done and then it has to be cropped to a certain resolution and / or display aspect ratio, calculating the pixel aspect ratio too. Personally I use square pixels only.

When storing the Android Mid Preset I found "maximum width" and "maximum height". Is there a connection to my question?
User avatar
JohnAStebbins
HandBrake Team
Posts: 5726
Joined: Sat Feb 09, 2008 7:21 pm

Re: Automatic Cropping, eg for Android

Post by JohnAStebbins »

It sounds like what you want is a checkbox that says "use this exact resolution" and does whatever is necessary to attain both the width and height that is specified while keeping as much of the original video as possible.

Usually, there would be 2 ways to attain that goal. Undercrop (leave some black bars), which is going to downscale the video more. Or overcrop (cut some video), which scales less but looses a slice of video on the sides. So you might want additional sub-options to choose between over/under cropping. Another thing to consider is whether it is the storage resolution you are fixing or the display resolution (if anamorphic is disabled or the source video is non-anamorphic, then storage and display resolution are the same). I don't know which your android requires, but I could see there being a need for both.

As you can see, this one feature would add quite a few widgets to the UI. But I'm in favor of it since it improves device compatibility. We'll have to see how the other developers feel.
linuxuser
Bright Spark User
Posts: 208
Joined: Fri Jan 06, 2012 7:47 pm

Re: Automatic Cropping, eg for Android

Post by linuxuser »

As mentioned I have problems with black bars, but I agree that other people could prefer black bars. Personally I think with low resolutions and small displays it is better to have no black bars and to loose a little bit of the image. SInce you created Android presets, which player did you use with an Android mobile phone for testing? Maybe there is another player, which works better with Handbrake-files.

I am having audio sync problems with the dolphin player too and have no idea what to do against it, especially after I moved the stream fast forward. The delay is a few seconds, not ms. To add the option "web optimized" didn't help.

I use a 800MHz CPU (LG E510 Optimus Hub) and as you see below I optimized the video for this mobile phone. If I use a higher resolution it works even a little bit with mkv / H264 (768x432p), but it flickrs a lot, so in this case I think the cpu of the mobile phone is too weak simply.

Does a lower quality, eg 26 need more cpu than a higher quality, eg 22?


Code: Select all

mediainfo greta_3.2_480x320p_25fpsv_456kbps_avc1_aac_48khz_1h28mn.m4v 
General
Complete name                            : greta_3.2_480x320p_25fpsv_456kbps_avc1_aac_48khz_1h28mn.m4v
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42
File size                                : 287 MiB
Duration                                 : 1h 28mn
Overall bit rate mode                    : Variable
Overall bit rate                         : 456 Kbps
Encoded date                             : UTC 2012-01-28 11:51:09
Tagged date                              : UTC 2012-01-28 12:23:31
Writing application                      : HandBrake 4418svn 2012012301

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Baseline@L2.1
Format settings, CABAC                   : No
Format settings, ReFrames                : 2 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 1h 28mn
Bit rate mode                            : Variable
Bit rate                                 : 325 Kbps
Width                                    : 480 pixels
Height                                   : 320 pixels
Display aspect ratio                     : 3:2
Frame rate mode                          : Variable
Frame rate                               : 25.000 fps
Minimum frame rate                       : 16.667 fps
Maximum frame rate                       : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.085
Stream size                              : 205 MiB (71%)
Writing library                          : x264 core 119
Encoding settings                        : cabac=0 / ref=2 / deblock=1:0:0 / analyse=0x1:0x111 / me=umh / subme=6 / psy=1 / psy_rd=1,00:0,00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=0 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=26,0 / qcomp=0,60 / qpmin=3 / qpmax=69 / qpstep=4 / ip_ratio=1,40 / aq=1:1,00
Encoded date                             : UTC 2012-01-28 11:51:09
Tagged date                              : UTC 2012-01-28 12:23:31
Color primaries                          : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
Transfer characteristics                 : BT.709-5, BT.1361
Matrix coefficients                      : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 1h 28mn
Bit rate mode                            : Variable
Bit rate                                 : 128 Kbps
Maximum bit rate                         : 157 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 80.7 MiB (28%)
Language                                 : German
Encoded date                             : UTC 2012-01-28 11:51:09
Tagged date                              : UTC 2012-01-28 12:23:31
User avatar
JohnAStebbins
HandBrake Team
Posts: 5726
Joined: Sat Feb 09, 2008 7:21 pm

Re: Automatic Cropping, eg for Android

Post by JohnAStebbins »

s55 created the android preset. He'll have to respond regarding that. But regarding the sync issues, you might try setting constant framerate on the video tab.
User avatar
s55
HandBrake Team
Posts: 10360
Joined: Sun Dec 24, 2006 1:05 pm

Re: Automatic Cropping, eg for Android

Post by s55 »

The Android presets are not suitable for low-end android phones. I didn't include a preset for low-end devices as video playback on them is too unreliable and unpredictable.
At an absolute minimum, The Mid preset is designed for a 1Ghz Snapdragon using the stock android video player. 3rd party players will likely be hit or miss.

If you want to create your own preset, I'd be inclined to use mpeg4 at 320 x 480 or less and as low a bitrate as you can tolerate.
TedJ
Veteran User
Posts: 5388
Joined: Wed Feb 20, 2008 11:25 pm

Re: Automatic Cropping, eg for Android

Post by TedJ »

For gits and shiggles I just tried the Android High preset on my Xperia arc and it worked using the stock gallery player. :-)
Post Reply