\n\n```\n\n---\n\n## Important tips\n- Use **H.264 video + AAC audio** for widest compatibility.\n- Keep segment duration around **4–6 seconds**.\n- Serve with correct MIME types:\n - `.m3u8` → `application/vnd.apple.mpegurl`\n - `.ts` → `video/mp2t`\n - `.m4s` → `video/iso.segment`\n- Use **HTTPS** for production playback.\n- If you want adaptive streaming, create a **master playlist** with multiple renditions.\n\nIf you want, I can give you:\n1. a **single-command FFmpeg recipe** for your exact MP4, or \n2. a **Docker/Node/Python script** to automate MP4 → HLS conversion."}}}

Prompt

How do I convert MP4 to HLS for web and mobile playback?

Technology / Developer Tools1 observationLast seen Nov 1, 2026

Latest observation

Nov 1, 2026OpenAI APIWeb search: off

To convert an MP4 into HLS for web and mobile playback, you usually:

  1. Transcode the video into one or more bitrate/resolution variants
  2. Segment each variant into short .ts or .m4s chunks
  3. Generate an .m3u8 playlist
  4. Serve the playlist and segments over HTTP/HTTPS

Option 1: Using FFmpeg

FFmpeg is the most common tool.

Basic HLS conversion

ffmpeg -i input.mp4 \
  -codec: copy \
  -start_number 0 \
  -hls_time 6 \
  -hls_list_size 0 \
  -f hls output.m3u8

This creates:

  • output.m3u8
  • segment files like output0.ts, output1.ts, etc.

Better for compatibility

If your MP4 isn’t already in a web-friendly codec, re-encode to H.264/AAC:

ffmpeg -i input.mp4 \
  -c:v libx264 -profile:v main -crf 20 -preset medium \
  -c:a aac -b:a 128k \
  -hls_time 6 \
  -hls_playlist_type vod \
  -hls_segment_filename "segment_%03d.ts" \
  output.m3u8

Option 2: Multi-bitrate HLS for adaptive streaming

For best web/mobile playback, create multiple renditions (e.g. 1080p, 720p, 480p) and a master playlist.

Example:

ffmpeg -i input.mp4 \
  -filter_complex "[0:v]split=3[v1][v2][v3]; \
                   [v1]scale=1920:1080[v1out]; \
                   [v2]scale=1280:720[v2out]; \
                   [v3]scale=854:480[v3out]" \
  -map "[v1out]" -map 0:a -c:v:0 libx264 -b:v:0 5000k -c:a:0 aac -b:a:0 128k \
  -map "[v2out]" -map 0:a -c:v:1 libx264 -b:v:1 2800k -c:a:1 aac -b:a:1 128k \
  -map "[v3out]" -map 0:a -c:v:2 libx264 -b:v:2 1200k -c:a:2 aac -b:a:2 96k \
  -f hls \
  -hls_time 6 \
  -hls_playlist_type vod \
  -master_pl_name master.m3u8 \
  -var_stream_map "v:0,a:0 v:1,a:1 v:2,a:2" \
  -hls_segment_filename "v%v/seg_%03d.ts" \
  v%v/prog_index.m3u8

This creates:

  • master.m3u8
  • variant playlists in folders like v0/, v1/, v2/

Option 3: HLS with fMP4 segments

For newer Apple/web workflows, you can use fragmented MP4 segments:

ffmpeg -i input.mp4 \
  -c:v libx264 -c:a aac \
  -hls_time 6 \
  -hls_segment_type fmp4 \
  -hls_playlist_type vod \
  output.m3u8

This outputs .m4s segments instead of .ts.


Web playback

Use an HLS-capable player:

  • Safari/iOS: native HLS support
  • Browsers like Chrome/Firefox/Edge: use hls.js
  • Mobile apps:
    • iOS: AVPlayer
    • Android: ExoPlayer / Media3

Example with hls.js

<video id="video" controls></video>
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<script>
  const video = document.getElementById('video');
  const src = 'https://example.com/master.m3u8';

  if (Hls.isSupported()) {
    const hls = new Hls();
    hls.loadSource(src);
    hls.attachMedia(video);
  } else if (video.canPlayType('application/vnd.apple.mpegurl')) {
    video.src = src;
  }
</script>

Important tips

  • Use H.264 video + AAC audio for widest compatibility.
  • Keep segment duration around 4–6 seconds.
  • Serve with correct MIME types:
    • .m3u8 → application/vnd.apple.mpegurl
    • .ts → video/mp2t
    • .m4s → video/iso.segment
  • Use HTTPS for production playback.
  • If you want adaptive streaming, create a master playlist with multiple renditions.

If you want, I can give you:

  1. a single-command FFmpeg recipe for your exact MP4, or
  2. a Docker/Node/Python script to automate MP4 → HLS conversion.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.