What to use to decode video?


#1

I need to extract frames from video files (with support for most common formats, ideally cross-platform). Is there a create that does it?

I’ve tried rust-media, but it seems the project is dead - pull requests not merged for 2 years, and it doesn’t even compile any more. Is there anything else?


#2

You can look into https://github.com/sdroege/gstreamer-rs. The library is a rust binding to the gstreamer library. Although gstreamers purpose is live video / audio processing and filtering, you most probably can also use it for extracting simple video frames.

Gstreamer is cross platform compatible, and has also support for many video and audio codecs.

Here is the link to the C library: https://gstreamer.freedesktop.org/

Bonus: From my knowledge it seems like, that the people over from the gstreamer team, are also using rust for some of their newer projects / code.


#3

Thanks for the suggestion.


#4

ffmpeg


#5

Although gstreamers purpose is live video / audio processing and filtering, you most probably can also use it for extracting simple video frames

Small correction: it’s a general purpose multimedia framework, not really for live audio/video processing only :slight_smile:

You can find an example using gstreamer-rs for extracting raw audio (from a test source) here: https://github.com/sdroege/gstreamer-rs/blob/master/examples/src/bin/appsink.rs . You can do basically the same for video, and could do it from a file by using an appsink in a similar way and combine it with the example here https://github.com/sdroege/gstreamer-rs/blob/master/examples/src/bin/decodebin.rs