kokolegorille
Ffmpeg, video to png
Hello everyone,
I am trying to extract thumbnail from video with waffle and ffmpeg.
I do have a transformer like this
def transform(:thumb, _) do
{:ffmpeg, fn(input, output) -> "-i #{input} -f png #{output}" end, :png}
end
but this fail with
Unable to find a suitable output format
And this fail in the console too.
$ ffmpeg -i small.mp4 -f png out_small.png
...
[NULL @ 0x7f8e93801400] Requested output format 'png' is not a suitable output format
out_small.png: Invalid argument
It looks my ffmpeg does not support png creation, as png is not listed in formats.
$ ffmpeg -formats | grep png
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_1 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.0.1.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-13.0.1.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
DE apng Animated Portable Network Graphics
D png_pipe piped png sequence
I have success using apng, or gif, but not png, nor jpg.
I guess it is my ffmpeg version which is broken. It’s the latest installed by brew, on Mac osx.
So my question is, do You have png listed in your ffmpeg formats?
Thanks in advance
Marked As Solved
sneako
I think you just need to provide a few more arguments to your ffmpeg command and that by default, ffmpeg assumes you want to convert the video to another video format.
I am running MacOS and ffmpeg 4.2.2 as well and am able to create a thumbnail with the following command:
ffmpeg -i sample.mp4 -ss 00:00:01.000 -vframes 1 output.png
Note we tell ffmpeg to take 1 frame (with -vframes 1), from a specific point (-ss <timestamp>) in the video.
Also Liked
kokolegorille
After many tests, I found the solution. The format to specify is now image2 for png.
This works
def transform(:thumb, _) do
{:ffmpeg, fn(input, output) -> ["-i", input, "-f", "image2", "-vframes", "1", output] end, :png}
end
# or this too
def transform(:thumb, _) do
{:ffmpeg, fn(input, output) -> "-i #{input} -f image2 -vframes 1 #{output}" end, :png}
end
It’s possible to pass a list or a string, but -f image2 is the key.
For reference, this is where I found the way to correctly transform a video to a png thumbnail.
Thank You all for the helps ![]()
hauleth
Are you sure that there are no spaces in input and output?
Kurisu
I have ffmpeg version 3.4.6 and it seems I have the same supported formats.
Here is the output of the command ffmpeg -formats | grep png:
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
DE apng Animated Portable Network Graphics
D png_pipe piped png sequence
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










