How to convert HEVC (H.265) video to H.264
Convert HEVC (H.265) to H.264 by re-encoding the video stream. On Sume, an exact trim of a whole non-HDR clip returns an H.264 MP4.

To convert HEVC to H.264, re-encode the video stream: decode the H.265 frames and compress them again with an H.264 encoder such as FFmpeg's libx264. Renaming the file doesn't change the codec, and neither does a stream copy into a new container, which moves the compressed packets as they are. With Sume, trim a whole non-HDR clip at the default exact precision: the result is a new MP4 with H.264 video and any kept audio as AAC.
The facts come from the Video trim and Video inspect docs, the Sume API reference, and FFmpeg's ffmpeg and codecs documentation, read on 2026-09-27. Anything described as current behavior is read from Sume's code.
How do I convert HEVC to H.264 with FFmpeg?
FFmpeg's documentation uses this command as its transcoding example: it decodes the video, encodes it again with libx264, and copies the audio as it is. Point -i at your HEVC file and name the output:
- FFmpeg's docs name feeding a stream to something that cannot decode the original codec as a typical reason to transcode.
- The same docs say encoding in most cases degrades quality, so convert once, from the original file, not from an earlier conversion.
- A stream copy, like
-c:a copyfor the audio, might not work in some cases, the docs add, for example when the target container needs information the source lacks.
ffmpeg -i INPUT.mkv -map 0:v -map 0:a -c:v libx264 -c:a copy OUTPUT.mp4How do I convert a Sume-hosted clip with the API?
Sume's media tools read only your workspace's media.sume.com files, such as an earlier Sume job's output; which URLs each endpoint accepts explains the rule. Run a free probe first, POST /v1/video-inspect with frames: false: video_codec names the codec, duration_seconds gives the length, and hdr flags PQ and HLG sources. Then trim from 0 to the full length:
precisiondefaults toexact, the frame-accurate re-encode. Don't sendkeyframe: it is a stream copy, so the video would stay HEVC.- An
endpast the source clamps to it and warnstrim_clamped_to_source, but a range longer than 900 seconds is refused withvideo_trim_range_empty. - The default
modeisasync: pollGET /v1/jobs/:id/status, then readGET /v1/jobs/:id/result, whosevideo_urlis the new MP4. The source is untouched.
curl -X POST https://api.sume.com/v1/video-trim \
-H "Authorization: Bearer $SUME_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: hevc-to-h264-001" \
-d '{
"video_url": "https://media.sume.com/artifacts/artf_demo/clip-hevc.mp4",
"start": 0,
"end": 64.2
}'What settings does the converted file use?
You can't choose the codec or its quality: trim refuses codec, crf, and other ffmpeg fields with ffmpeg_fields_rejected. Today the trim compiler sets these:
| Setting | An exact trim today |
|---|---|
| Video codec | H.264 through libx264, which FFmpeg's docs describe as an H.264/MPEG-4 AVC encoder wrapper |
| Rate control | CRF 18, libx264's constant quality mode, with the veryfast preset |
| Pixel format | yuv420p |
| Keyframes | About one second apart, when the source's frame rate is known |
| Audio | AAC at 192 kbps, when the audio is kept |
| Container | MP4 with +faststart |
| Size and frame rate | The source's, unless you set output: 256 to 2160 pixels per edge, and 24, 25, 30, or 60 fps |
Can Sume convert HDR HEVC to H.264?
Not with trim or filter. The probe's hdr is true for PQ and HLG transfers. In current code, an exact trim refuses those sources with hdr_source_unsupported and points to keyframe precision or an SDR source, while a keyframe trim copies the stream, so the video stays HEVC. Video filter refuses HDR sources too.
A Timeline render doesn't refuse HDR sources in current code, but Sume doesn't document how it handles their color, so don't count on a correct conversion from one.
What are the limits?
- Trim reads sources up to 1,800 seconds and writes at most 900 seconds per job, so a clip longer than 900 seconds takes two trims, and one longer than 1,800 seconds can't be trimmed. Joining them with a Timeline render encodes them a second time, with libx264 at CRF 20 in current code.
- An exact trim always writes H.264 in an MP4; there is no field to pick another codec.
- Trim is billed per job, plus a 5.5% agent fee by default; the docs say to confirm the rate in
GET /v1/catalog. The probe is unbilled. Sume API output formats lists what every other endpoint returns.
Sources
Related posts
More in Media tools
- Demand Gen video specs: sizes, lengths, and the 4:5 cut
Demand Gen takes 1:1, 16:9, 4:5, and optional 9:16 videos of at least 5 seconds, uploaded to YouTube. How to make each, including 4:5, with Sume.
- Detect language from audio with a speech-to-text API
Detect the language spoken in an audio file: run speech-to-text with no language hint, then read the detected code and confidence from the result.
- Facebook in-stream ads: video specs and the 15-second rule
Facebook in-stream video ads: 16:9 or 1:1, at least 1080×1080, 5–15 s on desktop. Ads of 15 s or less play in full; longer ones stop at 15 s.
- How to fix audio delay in a video by shifting the sound
Fix a video whose sound runs late or early: detach the audio and re-render the clip with the offset set as audio.source_in or the slot's source_in.
Written by Sume