DEV Community

Benji πŸ™
Benji πŸ™

Posted on

1

TIL you can convert media file extensions with ffmpeg

You can convert a video clips file extension using ffmpeg like this:

$ ffmpeg -i chill.mp4 chill.wav
$ ll
-rw-r--r--  1 hello  world  84317363 21 Jun  2022 chill.mp4
-rw-r--r--  1 hello  world  49074254 28 May 13:13 chill.wav
Enter fullscreen mode Exit fullscreen mode

You can also play directly from the terminal (which opens in a new window)

$ ffplay chill.mp4
Enter fullscreen mode Exit fullscreen mode

Streaming a video file using ffplay

And probably the most useful I found, which is to convert a video clip to a .gif for PRs/MRs

ffmpeg -i in.mov -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > out.gif
Enter fullscreen mode Exit fullscreen mode

Notes on the arguments:

  • -r 10 tells ffmpeg to reduce the frame rate from 25 fps to 10
  • -s 600x400 tells ffmpeg the max-width and max-height
  • --delay=3 tells gifsicle to delay 30ms between each gif
  • --optimize=3 requests that gifsicle use the slowest/most file-size optimization

(full credits for this one go to this README.md)

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here β†’

Top comments (1)

Collapse
 
Sloan, the sloth mascot
Comment deleted

Sentry image

See why 4M developers consider Sentry, β€œnot bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay