ffmpegwasm / ffmpegwasm/ffmpeg.wasm

Inconsistent Pixel Data Between WASM and Binary Executable in `rawvideo` Output

Open
#818 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
17.8k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
The same `ffmpeg` command produces slightly different pixel data when executed in a WebAssembly (WASM) environment versus the binary executable.

- **WASM Output:** `[57, 87, 77, 46, 47, 57, 48, 62, 65, 42, ...]`
- **Binary Output:** `[58, 88, 78, 47, 49, 58, 50, 63, 66, 43, ...]`

This inconsistency is observed in the output of a `rawvideo` file using the `gray` pixel format.

**To Reproduce**
Run the following command in both the WASM and binary environments:

```bash
ffmpeg -i input_file.mp4 \
-vf "crop=in_w*0.6:in_h*0.6:in_w*0.2:in_h*0.2,format=gray,scale=32:32" \
-f rawvideo -pix_fmt gray gray.raw
```

1. Replace `input_file.mp4` with any valid input file.
2. Compare the pixel data in the resulting `gray.raw` file from both environments.

**Expected behavior**
The pixel data in the `rawvideo` output (`gray.raw`) should be identical between the WASM and binary environments, as the same command is used with the same input file.

**Desktop**
- **OS:** Windows
- **Browser (for WASM):** Chrome
- **Browser Version:** 115
- **FFmpeg Binary Version:** 5.12, 7.1
- **FFmpeg WASM Version:** 0.11.6, 0.12.15

**Additional context**
- The issue is reproducible across multiple versions of both the WASM and binary implementations.
- The input file remains consistent during testing.
- It is unclear if this discrepancy arises from rounding, floating-point precision differences, or another internal factor.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.