Closed jankais3r closed 3 years ago
Hi, I'm going to have a look. ffmpeg is currently compiled with everything included with the distribution but no external library. Including external libraries is the next step.
ImageMagick (compiled to arm64) is included with the latest versions of a-Shell.
Some issues could be related to wasm and how it access the local file system.
Hi, I'm going to have a look. ffmpeg is currently compiled with everything included with the distribution but no external library. Including external libraries is the next step.
ImageMagick (compiled to arm64) is included with the latest versions of a-Shell.
Thank you for the information on imagemagick. I was able to create a good looking animated GIF with convert
, then make a video out of it using ffmpeg. Unfortunately, as far as I can tell, there is not a single codec supported by iOS. So while I was able to generate a valid mpeg4 AVI, there is no way to play it or share it on iOS. Support for additional encoders would be immensely helpful. Thank you for your work on a-shell.
Hi, I've added libx264 to the ffmpeg compiled version, if you can give it a try: https://github.com/holzschu/a-Shell-commands/releases/download/0.1/ffmpeg_x264.wasm
This new version appears to be able to load a png file, and to produce m4a and mp4 files that are readable by iOS ("play" does show them on screen). I'll have a look into the "multiple files" issue next.
Hi again, with approach 2, I now have the same error message as approach 5:
unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
I ran the program step by step, and ffmpeg is opening the files and calling stat
and fstat
on them. The meaning of the error message is that was unable to find the size of the png files in a limited time. It has no problems finding the size of a single png file, so it seems to be related with how ffmpeg tries to control the time it allows for subtasks.
Could you try with specifying the size of the images?
Hi, I've added libx264 to the ffmpeg compiled version, if you can give it a try: https://github.com/holzschu/a-Shell-commands/releases/download/0.1/ffmpeg_x264.wasm
Many thanks. I can confirm that I was able to generate an mp4 file playable on the iPad using this new binary 🥳
Hi again, with approach 2, I now have the same error message as approach 5:
unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options
I ran the program step by step, and ffmpeg is opening the files and calling
stat
andfstat
on them. The meaning of the error message is that was unable to find the size of the png files in a limited time. It has no problems finding the size of a single png file, so it seems to be related with how ffmpeg tries to control the time it allows for subtasks. Could you try with specifying the size of the images?
Thanks again for your investigative work on this issue. I was able to generate a movie from series of BMP images using the approach 2 while specifying image size. However, PNGs are still failing. The exact same syntax works with BMPs.
$ ffmpeg -s 500x500 -i frames/frame_%04d.png -c:v libx264 -vf fps=15 out.mp4
ffmpeg version N-97747-gffae62d96c Copyright (c) 2000-2020 the FFmpeg developers
built with clang version 12.0.0 (https://github.com/llvm/llvm-project e0905553b424afe94938e2cc010fcecd0822eaba)
configuration: --cc=/Users/holzschu/src/Xcode_iPad/wasi-sdk/opt/bin/clang --ar=/Users/holzschu/src/Xcode_iPad/wasi-sdk/opt/bin/ar --ranlib=/Users/holz
schu/src/Xcode_iPad/wasi-sdk/opt/bin/ranlib --disable-asm --enable-cross-compile --disable-avfoundation --disable-appkit --disable-network --disable-pth
reads --disable-debug --enable-libx264 --enable-gpl
libavutil 56. 45.100 / 56. 45.100
libavcodec 58. 84.100 / 58. 84.100
libavformat 58. 43.100 / 58. 43.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 80.100 / 7. 80.100
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Input #0, image2, from 'frames/frame_%04d.png':
Duration: 00:00:12.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, none, 500x500, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (? (?) -> h264 (libx264))
Decoder (codec png) not found for input stream #0:0
Hi, So the problem was not the time allocated to subtasks, but the fact that most png files are compressed and need zlib for access. There is now a new version of ffmpeg available for download, with zlib added to the list of external libraries. This one can decode png files and create mp4 movies, at least on my iPad.
I've had one failure, when trying to create a m4a movie with 2048x4096 images, but it was a malloc failure...
For simplification, the new ffmpeg binary replaced the old ffmpeg binary. I'm wondering: beyond libx264 and zlib, are there other libraries I should consider?
Hi,
I tried to use the pre-compiled ffmpeg to merge images into a video, but none of the possible approaches work.
Approach 1:
Approach 2:
Approach 3:
Approach 4:
Approach 5:
Besides this, there is also a problem with many lacking encoders and decoders, even though the binary is presented as “full version”. There is basically no modern encoder like h264 or h265 (these are present only as decoders), forcing the use of ancient mpeg4. Also basic image decoders are missing, like PNG or JPEG.
One potential solution to this problem would be to generate a single GIF file with all the frames and then use it as an input for ffmpeg, but Pillow produces horrible GIFs. I see you also have a fork of imagemagick - is there a plan to release a wasm binary of it?