Format Conversion
FlowPick can merge fragments and convert to standard formats while downloading streaming media. This document explains supported conversion paths, underlying technical principles, output format selection, and performance characteristics.

Prerequisite Concepts: Container vs Codec
Before understanding format conversion, need to distinguish two easily confused concepts:
| Concept | Description | Analogy |
|---|---|---|
| Container | File's "shell", determines file extension and internal data organization | Shipping box — determines package shape |
| Codec | Compression algorithm for audio/video data | Contents inside the box |
FlowPick's format conversion only changes the container, not the codec (i.e., "remuxing"). This means:
- Video quality and audio quality remain completely unchanged
- Conversion is very fast (no re-encoding involved)
- Cannot change codec formats (e.g., H.265 → H.264)
Conversion Path Overview
FlowPick supports following conversion paths, covering both HLS and DASH mainstream streaming protocols:
| Source Format | Target Format | Conversion Method | Speed | Quality | Typical Use Case |
|---|---|---|---|---|---|
| HLS (TS fragments) | MP4 | FFmpeg WASM Remuxing | Medium | Lossless | Universal playback, video editing |
| HLS (TS fragments) | TS | Binary Direct Concatenation | Extremely Fast | Lossless | Maximum speed, post-processing |
| DASH (MP4 fragments) | MP4 | FFmpeg WASM Remuxing | Medium | Lossless | Universal playback |
| DASH (FMP4 fragments) | MP4 | FFmpeg WASM Reassembly | Medium | Lossless | Requires init segment |
| DASH (separate audio/video) | MP4 | FFmpeg WASM Merge | Slower | Lossless | DASH separate audio/video streams |
"Lossless" means no re-encoding is performed; only container format is changed. Video and audio encoded data remain unchanged.
Technical Principles of Conversion
FlowPick uses two conversion engines, automatically selecting optimal solution based on scenario:
| Engine | Applicable Scenario | Advantages | Disadvantages |
|---|---|---|---|
| FFmpeg WASM | TS→MP4 remuxing, DASH merging, audio-video merge | Full functionality, supports complex conversions | Needs to load WASM file, higher memory usage |
| TSToMP4Muxer | TS→MP4 streaming remuxing | Pure JS implementation, no need to load FFmpeg, high memory efficiency | Only supports single TS→MP4 scenario |
TS Fragments → MP4 (FFmpeg WASM Remuxing)
HLS streams typically use MPEG-TS container. When converting to MP4, FlowPick uses FFmpeg WASM to perform following operations:
Input: Multiple .ts fragment files
Processing Flow:
- Write all TS fragments into FFmpeg virtual file system (WASM memory)
- Generate concat file list (
filelist.txt) - Execute remuxing command:
ffmpeg -f concat -safe 0 -i filelist.txt \
-c copy \
-movflags +faststart \
-bsf:a aac_adtstoasc \
output.mp4
Key Parameter Explanation:
| Parameter | Function | Why Needed |
|---|---|---|
-f concat | Use concat demuxer to concatenate fragments | TS fragments cannot be directly merged, need demuxer processing |
-safe 0 | Allow arbitrary file paths | WASM virtual file system has special path format |
-c copy | Stream copy mode, no re-encoding | Ensures lossless conversion, fastest speed |
-movflags +faststart | Move moov atom to beginning of file | Supports network progressive playback, watch while downloading |
-bsf:a aac_adtstoasc | AAC audio format conversion | TS uses ADTS format, MP4 needs ASC format |
Performance Characteristics:
- No encoding/decoding involved, low CPU usage
- Main time cost is in file I/O (WASM virtual file system read/write)
- Processing speed approximately 50-100 MB/s (depends on CPU and fragment count)
TS Fragments → MP4 (TSToMP4Muxer Streaming Remuxing)
For large file scenarios, FlowPick prioritizes using proprietary TSToMP4Muxer for streaming remuxing, avoiding FFmpeg WASM memory limitations:
Processing Flow:
- Parse TS packets one by one (188 bytes/packet), extract PES data
- Convert to MP4 format media data in real-time
- Stream write to disk via Streams API (FSA) or memory (Blob)
Advantages:
- Pure JavaScript implementation, no need to load FFmpeg WASM (saves ~30MB memory)
- Streaming processing, memory usage independent of file size
- Supports File System Access API for direct disk writing
Disadvantages:
- Only supports single TS→MP4 conversion path
- Does not support separate audio-video merging
TSToMP4Muxer is one of FlowPick's core innovations. It makes processing GB-scale video files possible in the browser without triggering memory overflow. See Download Engine for details.TS Fragments → TS (Direct Concatenation)
This is the fastest "conversion" method — actually performs no conversion at all, only binary concatenation of TS fragments in order.
Processing Flow:
- Download all TS fragments to memory
- Concatenate
ArrayBuffers sequentially into singleUint8Array - Write directly to file
Advantages:
- Zero CPU overhead, speed limited only by disk write speed
- Completely faithful, does not modify any bytes
- Suitable for subsequent processing with professional tools
Disadvantages:
- File size may be slightly larger than MP4 (TS container overhead ~5-15%)
- Some players have poorer support for TS files than MP4
DASH Fragments → MP4
DASH stream fragments are usually MP4 or FMP4 format. Conversion process:
Standard MP4 fragments:
ffmpeg -f concat -safe 0 -i filelist.txt \
-c copy \
-movflags +faststart \
output.mp4
FMP4 fragments (requires init segment):
ffmpeg -i init.mp4 -i video.mp4 -i audio.mp4 \
-c:v copy -c:a copy \
-movflags +faststart \
output.mp4
Audio-Video Separate Merge
DASH streams' video and audio are usually in different AdaptationSets. Merging process:
ffmpeg -f concat -safe 0 -i video_list.txt \
-f concat -safe 0 -i audio_list.txt \
-c:v copy -c:a copy \
-movflags +faststart \
-bsf:a aac_adtstoasc \
output.mp4
Output Format Selection Guide
MP4 (Recommended)
Use Cases:
- Need to play on various players and devices
- Need to import into video editing software (Premiere, DaVinci Resolve, etc.)
- Need to upload to video platforms (YouTube, Bilibili, etc.)
- Need to ensure maximum compatibility
Technical Details:
- Container: MPEG-4 Part 14
- MIME Type:
video/mp4 - Supports H.264/AVC, H.265/HEVC, AAC, MP3 etc. codecs
faststartflag ensures network progressive playback
TS
Use Cases:
- Pursue fastest download speed (skip remuxing step)
- Will further process with professional tools (e.g., FFmpeg CLI) later
- Source stream itself is TS format and doesn't need conversion
- Temporary storage, may delete later
Technical Details:
- Container: MPEG Transport Stream
- MIME Type:
video/mp2t - Each fragment independently playable
- File size typically 5-15% larger than MP4
Format Selection Decision Tree
Need max compatibility? ──Yes──→ Choose MP4
│
No
│
▼
Pursue fastest speed? ──Yes──→ Choose TS
│
No
│
▼
Will process with FFmpeg later? ──Yes──→ Choose TS
│
No
│
▼
Choose MP4 (Recommended)
Performance Comparison
Following is actual test data under typical conditions (Chrome 126, Intel i7-13700, 16GB RAM):
| Scenario | Fragment Count | Total Size | TS Concatenation | MP4 Remuxing (FFmpeg) | MP4 Streaming (Muxer) |
|---|---|---|---|---|---|
| 10 min 1080p video | ~60 | ~200 MB | <1 sec | ~3 sec | ~2 sec |
| 30 min 1080p video | ~180 | ~600 MB | <1 sec | ~8 sec | ~5 sec |
| 60 min 4K video | ~360 | ~2.5 GB | ~2 sec | ~30 sec | ~18 sec |
| 120 min 4K video | ~720 | ~5 GB | ~4 sec | ~60 sec | ~35 sec |
Above data are estimates; actual performance depends on CPU, memory, and browser state. Streaming Muxer shows more obvious advantages when processing large files.
Factors Affecting Conversion Speed
| Factor | Impact Level | Explanation |
|---|---|---|
| Fragment count | High | More fragments = more file I/O operations |
| Total file size | High | Directly affects read/write time |
| CPU performance | Medium | FFmpeg WASM needs CPU for demux/mux |
| Memory size | Medium | WASM virtual file system needs sufficient memory |
| Disk write speed | Medium | Greater impact when using FSA direct writes |
| Browser version | Low | Newer browsers have better WASM performance |
Limitations & Notes
Codec Format Limitations
FlowPick's conversion only changes container format, does not perform re-encoding. This means:
| Limitation | Explanation | Impact |
|---|---|---|
| Cannot convert codecs | H.265 source still outputs as H.265 | Older players may not support |
| Cannot change bitrate | Output bitrate matches source | Cannot compress file size |
| Cannot change resolution | Output resolution matches source | Cannot downgrade or upgrade quality |
| Cannot change framerate | Output framerate matches source | Cannot convert 60fps→30fps |
| Non-standard sample rate | Output remains as-is | Some players may behave abnormally |
Memory Limitations
FFmpeg WASM runs in browser, subject to following limitations:
| Limitation | Specific Value | Impact |
|---|---|---|
| WASM memory limit | 4GB (32-bit address space) | Very large files may exceed limit |
| Virtual file system | Stored in memory | File size limited by available memory |
| Multi-threaded mode | Requires SharedArrayBuffer | Needs correct COEP/COOP headers |
Browser Compatibility
| Feature | Chrome | Edge | Firefox | Safari |
|---|---|---|---|---|
| FFmpeg WASM single-threaded | Supported | Supported | Supported | Partially supported |
| FFmpeg WASM multi-threaded | Needs COEP/COOP | Needs COEP/COOP | Needs COEP/COOP | Not supported |
| TSToMP4Muxer streaming | Supported | Supported | Supported | Supported |
| TS direct concatenation | Supported | Supported | Supported | Supported |
Command Line Alternatives
If you're familiar with command line, you can use native FFmpeg for better performance:
# HLS → MP4
ffmpeg -i "https://example.com/playlist.m3u8" -c copy -bsf:a aac_adtstoasc output.mp4
# DASH → MP4
ffmpeg -i "https://example.com/manifest.mpd" -c copy output.mp4
# TS fragment concatenation
cat segment_*.ts > output.ts
# TS → MP4 remuxing
ffmpeg -i output.ts -c copy -bsf:a aac_adtstoasc output.mp4
Advantages of native FFmpeg:
| Advantage | Explanation |
|---|---|
| Not limited by browser memory | Can use all system memory |
| Hardware-accelerated encoding/decoding | Supports NVENC, QSV, VideoToolbox etc. |
| More formats and codecs | Supports hundreds of formats and codecs |
| Faster processing | Native code performance far exceeds WASM |
| Supports re-encoding | Can change codec format, bitrate, resolution |
FAQ
Why is converted MP4 smaller than TS?
TS container has header overhead per 188-byte packet, while MP4 container's index structure is more compact. After remuxing, file size typically reduces 5-15%, but audio-video data remains completely unchanged.
Does conversion lose quality?
No. FlowPick uses -c copy (stream copy) mode, only changing container format, no re-encoding. Every byte of video and audio is preserved as-is.
Why can't some videos play after conversion?
Possible reasons:
- Source video uses codec unsupported by your player (e.g., H.265)
- Missing fragments during conversion caused incomplete file
- Issue with source stream itself
Related Documentation
- Video Sniffing — Learn about detection principles for HLS and DASH streams
- Download Engine — Deep dive into streaming processing and memory management
- Configuration Reference — Download settings like output format
- Usage Guide — Step-by-step guide for format conversion operations
- Browser Compatibility — Browser support status for WASM and FSA
- Common Issues Troubleshooting — Diagnosis and resolution of conversion-related issues
- Known Issues — Known limitations of format conversion
Privacy & Security
Complete privacy and security documentation for FlowPick, covering zero data collection, local processing, permission explanations, network behavior, and security best practices.
Batch Download
FlowPick batch download guide — leveraging browser's native download capabilities to save multiple media resources with one click. Covers resource selection, filtering tips, and practical advice.