Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Google Transcoder preset with custom resolution for HLS and DASH

Hi Team,

Please help me to edit preset/web-hd which one use for Transcode video.

I need to add  new resolution(1920x1080) in the predefined preset web-hd.

I tried to edit above preset json, but not able to do. Please help me to edit this json or share the PHP code to create new preset with all options had in web-hd preset

0 1 192
1 REPLY 1

Hi @satheesh-kumar,

Welcome to Google Cloud Community!

To edit the preset for video transcoding and add a new resolution (1920x1080) to the existing web-hd preset, you can either directly edit the JSON file or create a new preset using PHP. For detailed information on video transcoding presets, refer to the official transcoding documentation.

Here’s how to modify the web-hd Preset:

1. Locate the Preset File: Navigate to the directory where your video transcoding software stores its presets. Common locations include:

  • /path/to/your/transcoding/software/presets
  • /path/to/your/transcoding/software/config/presets

2. Find the web-hd Preset: Look for a file named web-hd.json or web_hd.json

3. Open the JSON File: Use a text editor like Notepad++, Sublime Text, or VS Code to open the web-hd.json file.

4. Edit the Resolution: Locate the section in the JSON that defines the resolution, which may appear like this:

"video": {
  "width": 1280,
  "height": 720 
}

And then change the values to set width to 1920 and height to 1080.

5. Save the Changes: Save the modified web-hd.json file.

Steps in creating a New Preset with PHP:

1. preset Array: Defines the configuration for your new preset.

2. name: The user-friendly name of your preset (e.g., custom_1080p).

3. video: Contains video-specific settings:

  • codec: Video codec. The choice depends on the type of video and desired compression. 
  • width, height: Resolution in pixels (e.g., 1920x1080 for 1080p).
  • bitrate: Video bitrate in bits per second (bps). Higher bitrates result in better quality but larger file sizes.
  • framerate: Frames per second (FPS) of the video. Common frame rates include 24, 25, and 30 FPS.

4. audio: Contains audio settings:

  • codec: Audio codec. The choice depends on the type of audio and desired compression.
  • bitrate: Audio bitrate in bits per second (bps).
  • channels: Number of audio channels (e.g., 2 for stereo, 5.1 for surround sound).

5. JSON Encoding: The PHP json_encode() function converts the preset array into a JSON string.

6. File Creation: The code writes the JSON string to a file (optional).

Additional Tips:

  • Software-Specific Documentation: Always refer to the documentation of your specific transcoding software (e.g., FFmpeg, Handbrake) for the most accurate and up-to-date settings.
  • Testing: Transcode a short video using your newly created preset to verify that the settings work as expected.

I hope the above information is helpful.