ffmpegwasm / ffmpegwasm/ffmpeg.wasm
ffmpeg.exec hangs forever without error when I try to resize a video, but only when using the multithreaded version, while using a Chromium based browser or Safari. No issues on Firefox.
- Dominant language
- C
- Stars
- 17.8k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
If I try to resize a video, either with the `-s` param or something like `-vf scale=-2:480`, the execution will simply hang forever and never give an error, but only when using the core-mt version (umd). If I try with the single-threaded version (core), everything works fine
**To Reproduce**
- Use Google Chrome on macOS (similar things happen on Chromium on Linux)
- Go to the `/apps/vanilla-app/public/transcode-mt.html` file in this project
- Modify this line: `await ffmpeg.exec(['-i', name, 'output.mp4']);` to `await ffmpeg.exec(['-i', name, '-filter:v', 'scale=-2:480', 'output.mp4']);`
- It hangs
- Do the same modification to the non-mt html file
- It does not hang
- Same issue on Safari
- Everything works on Firefox, mt or non-mt
**Expected behavior**
ffmpeg.exec should not hang and successfully encode the video, or at the very least give an error.
**Logs**
Here are the logs (directly from `ffmpeg.on("log" ...)`
```
[FFmpeg] ffmpeg version 5.1.4 Copyright (c) 2000-2023 the FFmpeg developers
[FFmpeg] built with emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.40 (5c27e79dd0a9c4e27ef2326841698cdd4f6b5784)
[FFmpeg] configuration: --target-os=none --arch=x86_32 --enable-cross-compile --disable-asm --disable-stripping --disable-programs --disable-doc --disable-debug --disable-runtime-cpudetect --disable-autodetect --nm=emnm --ar=emar --ranlib=emranlib --cc=emcc --cxx=em++ --objcc=emcc --dep-cc=emcc --extra-cflags='-I/opt/include -O3 -msimd128 -sUSE_PTHREADS -pthread' --extra-cxxflags='-I/opt/include -O3 -msimd128 -sUSE_PTHREADS -pthread' --enable-gpl --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libopus --enable-zlib --enable-libwebp --enable-libfreetype --enable-libfribidi --enable-libass --enable-libzimg
[FFmpeg] libavutil 57. 28.100 / 57. 28.100
[FFmpeg] libavcodec 59. 37.100 / 59. 37.100
[FFmpeg] libavformat 59. 27.100 / 59. 27.100
[FFmpeg] libavdevice 59. 7.100 / 59. 7.100
[FFmpeg] libavfilter 8. 44.100 / 8. 44.100
[FFmpeg] libswscale 6. 7.100 / 6. 7.100
[FFmpeg] libswresample 4. 7.100 / 4. 7.100
[FFmpeg] libpostproc 56. 6.100 / 56. 6.100
[FFmpeg] Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input_1503edd15afe4f709ee5c8c782ca25dd.mp4':
[FFmpeg] Metadata:
[FFmpeg] major_brand : isom
[FFmpeg] minor_version : 512
[FFmpeg] compatible_brands: isomiso2avc1mp41
[FFmpeg] encoder : Lavf59.16.100
[FFmpeg] Duration: 00:02:19.10, start: 0.000000, bitrate: 1929 kb/s
[FFmpeg] Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 1729 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
[FFmpeg] Metadata:
[FFmpeg] handler_name : VideoHandler
[FFmpeg] vendor_id : [0][0][0][0]
[FFmpeg] Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 191 kb/s (default)
[FFmpeg] Metadata:
[FFmpeg] handler_name : SoundHandler
[FFmpeg] vendor_id : [0][0][0][0]
[FFmpeg] Stream mapping:
[FFmpeg] Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
[FFmpeg] Stream #0:1 -> #0:1 (aac (native) -> aac (native))
(this is where it hangs)
```
**Desktop**
- macOS 13.3.1
- Chrome, Safari
**Additional context**
If there are issues with reproducing the bug, I'm not against the idea of doing a video call and sharing my screen
Contributor guide
Assessment
This issue has not been assessed yet.