diff options
author | Rodeo <[email protected]> | 2013-03-04 14:16:12 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-03-04 14:16:12 +0000 |
commit | f33223991ef5a16ae3fa3a4d99295f6cff3e80e1 (patch) | |
tree | e52f214a801925db55a6f11efb33601d085407c8 | |
parent | cf5277acc04d98d698ec03c4a91e48c5f24b00c3 (diff) |
2013 preset changes:
- updated descriptions (all presets)
- add maximum height (device presets)
- harmonize PFR framerates (29.97 to 30 fps)
- move qpmin hack from encx264 to the AppleTV preset
- Android preset: switch to level 3.0 (720x576 @ Level 2.2 meant 12.5 fps max.)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5299 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/encx264.c | 7 | ||||
-rw-r--r-- | macosx/HBPresets.h | 22 | ||||
-rw-r--r-- | macosx/HBPresets.m | 1853 |
3 files changed, 960 insertions, 922 deletions
diff --git a/libhb/encx264.c b/libhb/encx264.c index b52832416..eee738604 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -96,13 +96,6 @@ int encx264Init( hb_work_object_t * w, hb_job_t * job ) /* Enable metrics */ param.analyse.b_psnr = 1; param.analyse.b_ssim = 1; - - /* - * QuickTime has trouble with very low QPs (resulting in visual artifacts). - * Known to affect QuickTime 7, QuickTime X and iTunes. - * Testing shows that a qpmin of 4 usually works. - */ - param.rc.i_qp_min = 4; if( job->pass == 2 && job->cfr != 1 ) { diff --git a/macosx/HBPresets.h b/macosx/HBPresets.h index 598971efa..139b200ed 100644 --- a/macosx/HBPresets.h +++ b/macosx/HBPresets.h @@ -6,26 +6,28 @@ #import <Cocoa/Cocoa.h> - @interface HBPresets : NSObject {} -/* Called by -addFactoryPresets in Controller.mm */ -- (NSMutableArray *) generateBuiltinPresets: (NSMutableArray *) UserPresets; +/* Called by -addFactoryPresets in Controller.m */ +- (NSMutableArray *)generateBuiltinPresets:(NSMutableArray *)UserPresets; -/* Built-In Preset Dictionaries (one for each built in preset) */ +/* Dictionaries for preset folders ("Devices, "Regular") */ - (NSDictionary *)createDevicesPresetFolder; - (NSDictionary *)createRegularPresetFolder; +/* Dictionaries for individual presets ("Devices" folder) */ +- (NSDictionary *)createUniversalPreset; +- (NSDictionary *)createiPodPreset; +- (NSDictionary *)createiPhoneiPodtouchPreset; - (NSDictionary *)createiPadPreset; -- (NSDictionary *)createAppleTV2Preset; - (NSDictionary *)createAppleTVPreset; +- (NSDictionary *)createAppleTV2Preset; - (NSDictionary *)createAppleTV3Preset; -- (NSDictionary *)createUniversalPreset; -- (NSDictionary *)createiPhoneiPodtouchPreset; -- (NSDictionary *)createiPodPreset; -- (NSDictionary *)createNormalPreset; -- (NSDictionary *)createHighProfilePreset; - (NSDictionary *)createAndroidPreset; - (NSDictionary *)createAndroidTabletPreset; +/* Dictionaries for individual presets ("Regular" folder) */ +- (NSDictionary *)createNormalPreset; +- (NSDictionary *)createHighProfilePreset; + @end diff --git a/macosx/HBPresets.m b/macosx/HBPresets.m index 7d3aa0eac..f9936d10f 100644 --- a/macosx/HBPresets.m +++ b/macosx/HBPresets.m @@ -7,52 +7,50 @@ #import "HBPresets.h" @implementation HBPresets + - (id)init { self = [super init]; return self; } -/* Called by -addFactoryPresets in Controller.mm */ -- (NSMutableArray *) generateBuiltinPresets: (NSMutableArray *) UserPresets +/* Called by -addFactoryPresets in Controller.m */ +- (NSMutableArray *)generateBuiltinPresets:(NSMutableArray *)UserPresets { - /* We receive the user presets array of dictionaries from controller.mm */ - /* We re-create new built in presets programmatically and add them to our presets array */ - - /* Note: the built in presets will *not* sort themselves alphabetically, so they will - * appear in the order you create them + /* + * We receive the user presets array of dictionaries from Controller.m + * + * Re-create new built-in presets programmatically and add them to the array + * + * Note: the built-in presets will *not* sort themselves alphabetically, + * so they will appear in the order you create them. */ - /* Built in preset folders at the root of the hierarchy */ + + /* Built-in preset folders at the root of the hierarchy */ [UserPresets addObject:[self createDevicesPresetFolder]]; [UserPresets addObject:[self createRegularPresetFolder]]; /* Independent presets at the root hierarchy level would go here */ - /* return the newly regenerated preset array back to Controller.mm */ + /* Return the newly-regenerated preset array back to Controller.m */ return UserPresets; } #pragma mark - - -#pragma mark Built In Preset Folder Definitions +#pragma mark Preset Folder Definitions - (NSDictionary *)createDevicesPresetFolder { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Devices" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: YES] forKey:@"Folder"]; - - /* Lets initalize the child array of dictionaries for folders, this - is an array of dictionaries much like the root level of presets and - may contain folders and presets alike, etc.*/ + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Devices" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:YES] forKey:@"Folder"]; + + /* Initialize a child array, and add the individual presets to it */ NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; - /* we actually call the methods for the nests here */ [childrenArray addObject:[self createUniversalPreset]]; [childrenArray addObject:[self createiPodPreset]]; [childrenArray addObject:[self createiPhoneiPodtouchPreset]]; @@ -62,13 +60,13 @@ [childrenArray addObject:[self createAppleTV3Preset]]; [childrenArray addObject:[self createAndroidPreset]]; [childrenArray addObject:[self createAndroidTabletPreset]]; - - [preset setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; + /* Add the individual presets to the folder */ + [preset setObject:[NSMutableArray arrayWithArray:childrenArray] + forKey:@"ChildrenArray"]; + + /* Clean up and return the folder */ [childrenArray autorelease]; - - - [preset autorelease]; return preset; } @@ -76,1196 +74,1241 @@ - (NSDictionary *)createRegularPresetFolder { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Regular" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: YES] forKey:@"Folder"]; - - /* Lets initalize the child array of dictionaries for folders, this - is an array of dictionaries much like the root level of presets and - may contain folders and presets alike, etc.*/ + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Regular" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:YES] forKey:@"Folder"]; + + /* Initialize a child array, and add the individual presets to it */ NSMutableArray *childrenArray = [[NSMutableArray alloc] init]; - /* we actually call the methods for the nests here */ [childrenArray addObject:[self createNormalPreset]]; [childrenArray addObject:[self createHighProfilePreset]]; - [preset setObject:[NSMutableArray arrayWithArray: childrenArray] forKey:@"ChildrenArray"]; + /* Add the individual presets to the folder */ + [preset setObject:[NSMutableArray arrayWithArray:childrenArray] + forKey:@"ChildrenArray"]; + + /* Clean up and return the folder */ [childrenArray autorelease]; - - - [preset autorelease]; return preset; } #pragma mark - +#pragma mark Individual Preset Definitions +/* These NSDictionary definitions contain settings for one built-in preset */ -#pragma mark Built In Preset Definitions - -/* These NSDictionary Buit-In Preset definitions contain all of the settings for one built in preset */ -/* Note: For now, you can no longer have reference to any main window fields in your key values */ - -- (NSDictionary *)createAppleTVPreset +- (NSDictionary *)createUniversalPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"AppleTV" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's settings for the AppleTV and 2009's iPhone and iPod Touch lineup. Provides a good balance between quality and file size, and pushes the devices to their limits. Includes Dolby Digital 5.1 AC3 sound for the AppleTV." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Universal" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for compatibility with all Apple devices (including the iPod 6G and later). Includes Dolby Digital audio for surround sound." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the appleTV output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; + [preset setObject:@"fast" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"baseline" forKey:@"h264Profile"]; + [preset setObject:@"3.0" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:960] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:576] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru - TODO: enable + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + */ + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - /* Track 2 */ NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ + [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; + [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; + [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack2Array autorelease]; [audioListArray addObject:audioTrack2Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createUniversalPreset +- (NSDictionary *)createiPodPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Universal" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's universally compatible, full resolution settings for all current Apple devices: iPod (6G and up), iPhone, AppleTV, and Macs" forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"iPod" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for playback on the iPod with Video (all generations)." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the appleTV output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4iPodCompatible"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"fast" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"baseline" forKey:@"h264Profile"]; - [preset setObject:@"3.0" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"baseline" forKey:@"h264Profile"]; + [preset setObject:@"1.3" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:320] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:240] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PicturePAR"]; //none + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureKeepRatio"]; + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru - TODO: enable + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + */ + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - /* Track 2 */ - NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack2Array autorelease]; - [audioListArray addObject:audioTrack2Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createiPadPreset +- (NSDictionary *)createiPhoneiPodtouchPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"iPad" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's preset for the iPad (all generations) is optimized for a good balance between quality and filesize." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"iPhone & iPod touch" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for handheld iOS devices (iPhone 4, iPod touch 3G and later)." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"29.97 (NTSC Video)" forKey:@"VideoFramerate"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"3.1" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:960] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:640] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru - TODO: enable + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + */ + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createAppleTV2Preset +- (NSDictionary *)createiPadPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"AppleTV 2" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's preset for the Apple TV (2nd gen) is optimized for viewing on its 1280x720 display." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"iPad" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for playback on the iPad (all generations)." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"3.1" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"29.97 (NTSC Video)" forKey:@"VideoFramerate"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru - TODO: enable + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + */ + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - /* Track 2 */ - NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ - [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; - [audioTrack2Array autorelease]; - [audioListArray addObject:audioTrack2Array]; - - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createAppleTV3Preset +- (NSDictionary *)createAppleTVPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"AppleTV 3" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's preset for the Apple TV (3rd gen) is optimized for up to 1080p playback." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"AppleTV" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for the original AppleTV. Includes Dolby Digital audio for surround sound. Also compatible with iOS devices released since 2009." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"4.0" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"qpmin=4:cabac=0:ref=2:b-pyramid=none:weightb=0:weightp=0:vbv-maxrate=9500:vbv-bufsize=9500" + forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"3.1" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1920] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:960] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - /* We use Loose Anamorphic with a Modulus of 2 */ - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - /* Note: decided to use Fast Decomb. This makes this the only device preset using - * decomb that we have. Fast Decomb is better than no decomb imo and has basically no - * speed hit on progressive sources. Once Default decomb is sped up, we can switch */ - [preset setObject:[NSNumber numberWithInt:3] forKey:@"PictureDecomb"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru - TODO: enable + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + */ + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - /* Track 2 */ NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ + [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; + [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; + [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack2Array autorelease]; [audioListArray addObject:audioTrack2Array]; - - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createHighProfilePreset +- (NSDictionary *)createAppleTV2Preset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"High Profile" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's general-purpose preset for High Profile H.264 video, with all the bells and whistles." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"AppleTV 2" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for the second-generation AppleTV. Includes Dolby Digital audio for surround sound. NOT compatible with the original AppleTV." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String */ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"4.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"3.1" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; - [preset setObject:@"vfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - - /*Picture Settings*/ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; + [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureDecomb"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru - TODO: enable + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + */ + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - /* Track 2 */ NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; - [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; - [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; - [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; - /* Note: we ignore specified bitrate for AC3 Passthru in libhb and use - * the sources bitrate, however we need to initially set the value to something so - * the macgui doesnt barf, so 160 seems as good as anything */ + [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; + [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; + [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack2Array autorelease]; [audioListArray addObject:audioTrack2Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createiPhoneiPodtouchPreset +- (NSDictionary *)createAppleTV3Preset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"iPhone & iPod Touch" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's settings for all iPhones and iPod Touches going back to the original iPhone 2G." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"AppleTV 3" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for the third-generation AppleTV. Includes Dolby Digital audio for surround sound. NOT compatible with the original AppleTV. May stutter on the second-generation AppleTV." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - /* x264 Option String */ - [preset setObject:@"" forKey:@"x264Option"]; + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"high" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"29.97 (NTSC Video)" forKey:@"VideoFramerate"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"4.0" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /*Picture Settings*/ - /* Use a width of 960 for the iPhone 4 and later */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:960] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:1920] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:1080] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:3] forKey:@"PictureDecomb"]; //fast + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru - TODO: enable + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + */ + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Track 2 */ + NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; + [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; + [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; + [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; + [audioTrack2Array autorelease]; + [audioListArray addObject:audioTrack2Array]; + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createiPodPreset +- (NSDictionary *)createAndroidPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"iPod" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's low resolution settings for the iPod (5G and up). Optimized for great playback on the iPod screen, with smaller file size." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Android" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's settings for midrange devices running Android 2.3 or later." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; - /* x264 Option String */ - [preset setObject:@"" forKey:@"x264Option"]; + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"baseline" forKey:@"h264Profile"]; - [preset setObject:@"1.3" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"main" forKey:@"h264Profile"]; + [preset setObject:@"3.0" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"30" forKey:@"VideoFramerate"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /*Picture Settings*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:320] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:576] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru - TODO: enable + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + */ + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"128" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createNormalPreset +- (NSDictionary *)createAndroidTabletPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Normal" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:1] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's normal, default settings." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Android Tablet" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's preset for tablets running Android 2.3 or later." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String */ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"veryfast" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"main" forKey:@"h264Profile"]; - [preset setObject:@"4.0" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; - [preset setObject:@"vfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; - - /*Picture Settings*/ - /* Use Max Picture settings for whatever the dvd is.*/ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"main" forKey:@"h264Profile"]; + [preset setObject:@"3.1" forKey:@"h264Level"]; + + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; + + /* Video frame rate */ + [preset setObject:@"30" forKey:@"VideoFramerate"]; + [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; + + /* Picture size */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; + [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureHeight"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru - TODO: enable + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + */ + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"128" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createAndroidPreset +- (NSDictionary *)createNormalPreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Android" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset or factory 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's settings for Mid-range Android 2.3 or better devices." forKey:@"PresetDescription"]; + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"Normal" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Default"]; //default + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's normal, default settings." + forKey:@"PresetDescription"]; - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; - /* x264 Option String */ - [preset setObject:@"" forKey:@"x264Option"]; + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"main" forKey:@"h264Profile"]; - [preset setObject:@"2.2" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; + [preset setObject:@"veryfast" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"main" forKey:@"h264Profile"]; + [preset setObject:@"4.0" forKey:@"h264Level"]; - /* Video framerate */ - [preset setObject:@"29.97 (NTSC Video)" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; - - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + /* Video frame rate */ + [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; + [preset setObject:@"vfr" forKey:@"VideoFramerateMode"]; - /*Picture Settings*/ + /* Picture size */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:720] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) - /* Explicitly set the filters for built-in presets */ + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDecomb"]; //off + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ + /* Picture crop */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Auto Passthru - TODO: enable + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + */ - /* Track 1 */ + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"128" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; + /* Clean up and return the preset */ [preset autorelease]; return preset; } -- (NSDictionary *)createAndroidTabletPreset +- (NSDictionary *)createHighProfilePreset { NSMutableDictionary *preset = [[NSMutableDictionary alloc] init]; - - /* Get the New Preset Name from the field in the AddPresetPanel */ - [preset setObject:@"Android Tablet" forKey:@"PresetName"]; - - /*Set whether or not this is a user preset where 0 is factory, 1 is user*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; - [preset setObject:[NSNumber numberWithBool: NO] forKey:@"Folder"]; - - /* Get the New Preset Description from the field in the AddPresetPanel */ - [preset setObject:@"HandBrake's preset for the Higher end Anroid 2.3 or better devices." forKey:@"PresetDescription"]; - - /* File Format */ - [preset setObject:@"MP4 file" forKey:@"FileFormat"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4LargeFile"]; + + /* Preset properties (name, type: factory/user, default, folder, tooltip) */ + [preset setObject:@"High Profile" forKey:@"PresetName"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Type"]; //factory + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Default"]; + [preset setObject:[NSNumber numberWithBool:NO] forKey:@"Folder"]; + [preset setObject:@"HandBrake's general-purpose preset for High Profile H.264 video." + forKey:@"PresetDescription"]; + + /* Container format and related settings */ + [preset setObject:@"MP4 file" forKey:@"FileFormat"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"Mp4LargeFile"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4HttpOptimize"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"Mp4iPodCompatible"]; - - /* Chapter Markers*/ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"ChapterMarkers"]; - - /* Video encoder */ - [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; - - /* x264 Option String (We can use this to tweak the output)*/ - [preset setObject:@"" forKey:@"x264Option"]; + + /* Chapter markers */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"ChapterMarkers"]; + + /* Video encoder and advanced options */ + [preset setObject:@"H.264 (x264)" forKey:@"VideoEncoder"]; + [preset setObject:@"" forKey:@"lavcOption"]; + [preset setObject:@"" forKey:@"x264Option"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"x264UseAdvancedOptions"]; - [preset setObject:@"medium" forKey:@"x264Preset"]; - [preset setObject:@"" forKey:@"x264Tune"]; - [preset setObject:@"" forKey:@"x264OptionExtra"]; - [preset setObject:@"main" forKey:@"h264Profile"]; - [preset setObject:@"3.1" forKey:@"h264Level"]; - - /* Video quality */ - [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; - [preset setObject:[NSNumber numberWithFloat:22.0] forKey:@"VideoQualitySlider"]; - - /* Video framerate */ - [preset setObject:@"29.97 (NTSC Video)" forKey:@"VideoFramerate"]; - [preset setObject:@"pfr" forKey:@"VideoFramerateMode"]; + [preset setObject:@"medium" forKey:@"x264Preset"]; + [preset setObject:@"" forKey:@"x264Tune"]; + [preset setObject:@"" forKey:@"x264OptionExtra"]; + [preset setObject:@"high" forKey:@"h264Profile"]; + [preset setObject:@"4.1" forKey:@"h264Level"]; - /* GrayScale */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; - - /* 2 Pass Encoding */ - [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; - - /* Basic Picture Settings */ + /* Video rate control */ + [preset setObject:@"2500" forKey:@"VideoAvgBitrate"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTwoPass"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoTurboTwoPass"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"VideoQualityType"]; //cq + [preset setObject:[NSNumber numberWithFloat:20.0] forKey:@"VideoQualitySlider"]; + + /* Video frame rate */ + [preset setObject:@"Same as source" forKey:@"VideoFramerate"]; + [preset setObject:@"vfr" forKey:@"VideoFramerateMode"]; + + /* Picture size */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureSettings"]; - [preset setObject:[NSNumber numberWithInt:1280] forKey:@"PictureWidth"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureWidth"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureHeight"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; - [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PicturePAR"]; //loose [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureModulus"]; - - /* Explicitly set the filters for built-in presets */ + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureKeepRatio"]; //set to 0 for Loose (FIXME: why?) + + /* Picture filters */ [preset setObject:[NSNumber numberWithInt:1] forKey:@"UsesPictureFilters"]; + [preset setObject:[NSNumber numberWithInt:2] forKey:@"PictureDecomb"]; //default + [preset setObject:@"" forKey:@"PictureDecombCustom"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureDecombDeinterlace"]; //decomb [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeinterlace"]; + [preset setObject:@"" forKey:@"PictureDeinterlaceCustom"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; + [preset setObject:@"" forKey:@"PictureDetelecineCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDenoise"]; + [preset setObject:@"" forKey:@"PictureDenoiseCustom"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDeblock"]; - [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureDetelecine"]; - - /* Set crop settings here */ - /* The Auto Crop Matrix in the Picture Window autodetects differences in crop settings */ - [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; + [preset setObject:[NSNumber numberWithInt:0] forKey:@"VideoGrayScale"]; + + /* Picture crop */ + [preset setObject:[NSNumber numberWithInt:1] forKey:@"PictureAutoCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureTopCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureBottomCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureLeftCrop"]; [preset setObject:[NSNumber numberWithInt:0] forKey:@"PictureRightCrop"]; - - /* Audio - Is done on a track by track basis, ONLY specifiy the tracks we want set as any track - * not listed will be set to "None" and not encoded */ - NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; - /* Track 1 */ + /* Auto Passthru - TODO: enable + [preset setObject:@"AC3 (ffmpeg)" forKey:@"AudioEncoderFallback"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAACPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowAC3Pass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSHDPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowDTSPass"]; + [preset setObject:[NSNumber numberWithInt:1] forKey:@"AudioAllowMP3Pass"]; + */ + + /* Audio track list - no need to add "None" at the end */ + NSMutableArray *audioListArray = [[NSMutableArray alloc] init]; + /* Track 1 */ NSMutableDictionary *audioTrack1Array = [[NSMutableDictionary alloc] init]; - [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; - [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; - [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; - [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; - [audioTrack1Array setObject:@"128" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack1Array setObject:@"AAC (faac)" forKey:@"AudioEncoder"]; + [audioTrack1Array setObject:@"Dolby Pro Logic II" forKey:@"AudioMixdown"]; + [audioTrack1Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack1Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; [audioTrack1Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; [audioTrack1Array autorelease]; [audioListArray addObject:audioTrack1Array]; - - [preset setObject:[NSMutableArray arrayWithArray: audioListArray] forKey:@"AudioList"]; - - /* Subtitles*/ + /* Track 2 */ + NSMutableDictionary *audioTrack2Array = [[NSMutableDictionary alloc] init]; + [audioTrack2Array setObject:[NSNumber numberWithInt:1] forKey:@"AudioTrack"]; + [audioTrack2Array setObject:@"AC3 Passthru" forKey:@"AudioEncoder"]; + [audioTrack2Array setObject:@"None" forKey:@"AudioMixdown"]; + [audioTrack2Array setObject:@"Auto" forKey:@"AudioSamplerate"]; + [audioTrack2Array setObject:@"160" forKey:@"AudioBitrate"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackGainSlider"]; + [audioTrack2Array setObject:[NSNumber numberWithFloat:0.0] forKey:@"AudioTrackDRCSlider"]; + [audioTrack2Array autorelease]; + [audioListArray addObject:audioTrack2Array]; + /* Add the audio track(s) to the preset's audio list */ + [preset setObject:[NSMutableArray arrayWithArray:audioListArray] forKey:@"AudioList"]; + + /* Subtitles (note: currently ignored) */ [preset setObject:@"None" forKey:@"Subtitles"]; - + + /* Clean up and return the preset */ [preset autorelease]; return preset; } - @end |