holzschu / holzschu/a-shell

FFMpeg Video -> GIF conversion memory error

Open
#269 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Perl
Stars
3.9k
Forks
213
Avg merge
1m
Merged PRs (30d)
1

Description

Hi, I am converting videos to GIF using FFMPEG. This works fine for small videos (around 4 MB), but throws Out of memory error on larger videos (around 40 MB). I’m sure this is mainly a limitation of the iPadOS memory restrictions? I guess we do not really have something like top/ps to figure the memory consumed in real time. So, I can not report how much the conversion took.

### Testing setup
The files I use for testing
```bash
$ ls -lah|grep Video.MP4
-rw-r--r--@ 1 mobile mobile 35M Jun 16 14:04 HEIC-Video.MP4
-rw-r--r--@ 1 mobile mobile 3.7M Jun 14 12:58 Video.MP4
```

The command that I use for converting

### Works (smaller file)
```bash

ffmpeg -i Video.MP4 -filter_complex "[0:v] fps=12,scale=720:-1,split [a][b];[a] palettegen [p];[b][p]
paletteuse" CombinePDF.gif
```

### Does not work (larger file)
```bash

ffmpeg -i Video.MP4 -filter_complex "[0:v] fps=12,scale=720:-1,split [a][b];[a] palettegen [p];[b][p]
paletteuse" CombinePDF.gif
```

### Error

```bash
Error while filtering: Out of memory890kB time=00:00:00.00 bitrate=N/A speed= 0x
Failed to inject frame into filter network: Out of memory
Error while processing the decoded data for stream #0:1
```

It should be notes that the `890kB` you see in the above error is technically not a part of the error and is printed on the console before the error occurs. The `890kB` is from

```bash

frame= 0 fps=0.0 q=0.0 size= 890kB time=00:00:00.00 bitrate=N/A speed= 0x
```

While I think that ffmpeg will run faster when multi-threading support comes to WASM, I don’t think the memory bottleneck will be solved. Is that correct?

I saw that the latest dev notes allow for asking for more memory: https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_kernel_increased-memory-limit

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.