Hello and thanks for reading.
So I'm using Handbrake (video encoding) GUI version (not the CLI version).
I have a script that configures the settings for the GUI version. But I want to specify the default preset. Unfortunately, the default preset is not in the settings.json file.
The default preset is stored in the presets.json file.
The presets.json file contains all the presets (such as Very Fast 1080p30 and Fast 720p30, etc). I want to set Fast 720p30 as the default preset.
So I can find this in presets.json:
"PresetName": "Fast 720p30",
And just above that, I see this:
"Default": false,
Then I also look for this:
"PresetName": "Fast 1080p30",
And just above that I see this:
"Default": true,
So obviously 'Fast 1080p30' is the current default. I want to change that to 'Fast 720p30'.
To do that manually, I need to set 'Default' to true for 'Fast 720p30' and set 'Default' to false (or just remove the line) for 'Fast 1080p30'.
How can I do this using script? I am using Windows 7 SP1 so can use any scripting language that runs on Windows 7 (Batch, VBScript, PowerShell, JavaScript, maybe even R, etc).
My main problem is that I cannot find a way to access the '"Default": false,' line for any given preset because the JSON elements don't seem to have names. So I'm thinking maybe I need to find '"PresetName": "Fast 720p30",' then find the '"Default": false,' above that and change it, all using script. But I don't know how to do that.
I cannot paste the full presets.json file here because it's nearly 9000 lines long. But here is an edited version featuring the main parts:
{
"PresetList": [
{
"ChildrenArray": [
{
"AlignAVStart": true,
"AudioCopyMask": [
"copy:aac"
],
"AudioEncoderFallback": "ac3",
"AudioLanguageList": [],
"AudioList": [
{
"AudioBitrate": 160
}
],
"AudioSecondaryEncoderMode": true,
"AudioTrackSelectionBehavior": "first",
"ChapterMarkers": true,
"ChildrenArray": [],
"Default": false,
"PresetName": "Very Fast 1080p30",
"Type": 0
},
{
"AlignAVStart": true,
"AudioCopyMask": [
"copy:aac"
],
"AudioEncoderFallback": "ac3",
"AudioLanguageList": [],
"AudioList": [
{
"AudioBitrate": 160
}
],
"Default": false,
"PresetName": "Very Fast 720p30",
"Type": 0
},
{
"AlignAVStart": true,
"AudioCopyMask": [
"copy:aac"
],
"AudioEncoderFallback": "ac3",
"AudioLanguageList": [],
"AudioList": [
{
"AudioBitrate": 160
}
],
"AudioSecondaryEncoderMode": true,
"AudioTrackSelectionBehavior": "first",
"ChapterMarkers": true,
"ChildrenArray": [],
"Default": false,
"PresetName": "Very Fast 576p25",
"Type": 0,
},
{
"AlignAVStart": true,
"AudioCopyMask": [
"copy:aac",
"copy:ac3",
"copy:dtshd",
"copy:dts",
"copy:mp3",
"copy:truehd",
"copy:flac",
"copy:eac3"
],
"AudioEncoderFallback": "ac3",
"AudioLanguageList": [],
"AudioList": [
{
"AudioBitrate": 160,
"AudioCompressionLevel": 0.0,
"AudioDitherMethod": null,
"AudioEncoder": "av_aac",
"AudioMixdown": "stereo",
"AudioNormalizeMixLevel": false,
"AudioSamplerate": "auto",
"AudioTrackQualityEnable": false,
"AudioTrackQuality": -1.0,
"AudioTrackGainSlider": 0.0,
"AudioTrackDRCSlider": 0.0
}
],
"AudioSecondaryEncoderMode": true,
"AudioTrackSelectionBehavior": "first",
"ChapterMarkers": true,
"ChildrenArray": [],
"Default": false,
"PresetName": "Very Fast 480p30",
"Type": 0
},
{
"AlignAVStart": true,
"AudioCopyMask": [
"copy:aac",
"copy:ac3",
"copy:dtshd",
"copy:dts",
"copy:mp3",
"copy:truehd",
"copy:flac",
"copy:eac3"
],
"AudioEncoderFallback": "ac3",
"AudioLanguageList": [],
"AudioList": [
{
"AudioBitrate": 160,
"AudioCompressionLevel": 0.0,
"AudioDitherMethod": null,
"AudioEncoder": "av_aac",
"AudioMixdown": "stereo",
"AudioNormalizeMixLevel": false,
"AudioSamplerate": "auto",
"AudioTrackQualityEnable": false,
"AudioTrackQuality": -1.0,
"AudioTrackGainSlider": 0.0,
"AudioTrackDRCSlider": 0.0
}
],
"AudioSecondaryEncoderMode": true,
"AudioTrackSelectionBehavior": "first",
"ChapterMarkers": true,
"ChildrenArray": [],
"Default": true,
"PresetName": "Fast 1080p30",
"Type": 0
},
{
"AlignAVStart": true,
"AudioCopyMask": [
"copy:aac",
"copy:ac3",
"copy:dtshd",
"copy:dts",
"copy:mp3",
"copy:truehd",
"copy:flac",
"copy:eac3"
],
"AudioEncoderFallback": "ac3",
"AudioLanguageList": [],
"AudioList": [
{
"AudioBitrate": 160,
"AudioCompressionLevel": 0.0,
"AudioDitherMethod": null,
"AudioEncoder": "av_aac",
"AudioMixdown": "stereo",
"AudioNormalizeMixLevel": false,
"AudioSamplerate": "auto",
"AudioTrackQualityEnable": false,
"AudioTrackQuality": -1.0,
"AudioTrackGainSlider": 0.0,
"AudioTrackDRCSlider": 0.0
}
],
"AudioSecondaryEncoderMode": true,
"AudioTrackSelectionBehavior": "first",
"ChapterMarkers": true,
"ChildrenArray": [],
"Default": false,
"PresetName": "Fast 720p30",
"Type": 0
}
],
"Folder": true,
"PresetName": "Production",
"PresetDescription": null,
"Type": 0
}
],
"VersionMajor": 40,
"VersionMicro": 0,
"VersionMinor": 0
}
Many thanks.