DEV Community

Cover image for FFMPEG to the rescue, again
Kalle Tolonen
Kalle Tolonen

Posted on Originally published at kalletolonen.com

FFMPEG to the rescue, again

LinkedIn is going to be one of my direct integrations, if it's possible, so that I can write an article once and publish it on my own platform and do external distribution. Who has a non-svg logo available in 2026? I don't so I need to fix it.

Better and smarter ways exist, but we're Linux-neckbeards

It would be easy to use some ad-ridden page to convert my svg-logo to a png for LinkedIn's consumption, but no, we're not doing that. We're doing it the only way we should, which is via cli.

1st we encountered an esoteric err:

ffmpeg -i logo.svg -width 1920 logo.png
ffmpeg version 8.1 Copyright (c) 2000-2026 the FFmpeg developers
  built with Apple clang version 17.0.0 (clang-1700.6.4.2)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/8.1_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libsvtav1 --enable-libopus --enable-libx264 --enable-libmp3lame --enable-libdav1d --enable-libvmaf --enable-libvpx --enable-libx265 --enable-openssl --enable-videotoolbox --enable-audiotoolbox --enable-neon
  libavutil      60. 26.100 / 60. 26.100
  libavcodec     62. 28.100 / 62. 28.100
  libavformat    62. 12.100 / 62. 12.100
  libavdevice    62.  3.100 / 62.  3.100
  libavfilter    11. 14.100 / 11. 14.100
  libswscale      9.  5.100 /  9.  5.100
  libswresample   6.  3.100 /  6.  3.100
[in#0/svg_pipe @ 0x825014000] Could not find codec parameters for stream 0 (Video: svg, none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, svg_pipe, from 'logo.svg':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: svg, none, 25 fps, 25 tbr, 25 tbn
[vist#0:0/svg @ 0x824c1c180] Decoding requested, but no decoder found for: svg
Error opening output file logo.png.
Error opening output files: Invalid argument
Enter fullscreen mode Exit fullscreen mode

So that told us that we're missing a decoder, which means we'll need to install said codec.

brew uninstall ffmpeg
brew tap homebrew-ffmpeg/ffmpeg
brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-librsvg
Enter fullscreen mode Exit fullscreen mode

Running brew made it feel like it's the 1990's all over again with a package manager that's moar sluggish than Linux running on a 386.

Ffmpeg did do this chore like a boss, and we we're done in 30 minutes for a 5 second job.

ffmpeg -i logo.svg -vf "scale=1920:-1" logo.png
ffmpeg version 9.0.1 Copyright (c) 2000-2026 the FFmpeg developers
  built with Apple clang version 21.0.0 (clang-2100.1.1.101)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/9.0.1 --enable-shared --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libaom --enable-libdav1d --enable-libharfbuzz --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libsvtav1 --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-demuxer=dash --enable-neon --enable-opencl --enable-audiotoolbox --enable-videotoolbox --disable-htmlpages --enable-librsvg
  libavutil      61.  1.101 / 61.  1.101
  libavcodec     63.  1.101 / 63.  1.101
  libavformat    63.  1.101 / 63.  1.101
  libavdevice    63.  1.101 / 63.  1.101
  libavfilter    12.  1.101 / 12.  1.101
  libswscale     10.  1.101 / 10.  1.101
  libswresample   7.  1.101 /  7.  1.101
Input #0, svg_pipe, from 'logo.svg':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: svg (librsvg), bgra, 100x100, 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (svg (librsvg) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to 'logo.png':
  Metadata:
    encoder         : Lavf63.1.101
  Stream #0:0: Video: png, rgba(pc, gbr/unknown/unknown, progressive), 1920x1920, q=2-31, 200 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc63.1.101 png
[image2 @ 0x9fe804280] The specified filename 'logo.png' does not contain an image sequence pattern or a pattern is invalid.
[image2 @ 0x9fe804280] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image.
[out#0/image2 @ 0x9fec0c780] video:140KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.478x elapsed=0:00:00.08    
Enter fullscreen mode Exit fullscreen mode

Top comments (0)