[HN Gopher] Show HN: Golang FFmpeg wrapper for simple Video I/O ...
       ___________________________________________________________________
        
       Show HN: Golang FFmpeg wrapper for simple Video I/O and Webcam
       Streaming
        
       Author : crypt0lution
       Score  : 93 points
       Date   : 2022-04-16 15:51 UTC (7 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | _wp_ wrote:
       | There's quite a bit of overhead in execing and piping data from
       | ffmpeg. If performance is a concern, then using the C ffmpeg API
       | is a better bet(see pyav for a good example of this) . Cool
       | project though!
        
       | oefrha wrote:
       | README shows various structs with zero exported fields, and
       | example code working with those unexported fields which don't
       | make sense and won't work unless directly placed in this package.
       | There are other problems like non-idiomatic snake_case naming. I
       | guess this is OP's golang learning project? (To be clear, making
       | mistakes in the beginning is completely fine.)
        
         | crypt0lution wrote:
         | That's correct. I like to use go for image processing and
         | wanted to apply some of the algorithms I made to video but did
         | not find a simple way to do so. I set out to make a video I/O
         | module.
         | 
         | I'm currently fixing all the non-idiomatic problems as well as
         | adding some getters for each struct. Thanks for the feedback!
        
         | Philip-J-Fry wrote:
         | Yeah, you wouldn't be able to import this into a separate
         | module and use it.
        
       | DoctorOW wrote:
       | A couple years ago I tried making a GIF generator in Go and a
       | decent FFMPEG wrapper is something the Golang community needs.
        
         | psanford wrote:
         | Did you look at joy4[0] (or now joy5[1])? These wrappers expose
         | a lot of ffmpeg functionality in a Go idiomatic style. You
         | could easily write a GIF generator using them.
         | 
         | [0]: https://github.com/nareix/joy4
         | 
         | [1]: https://github.com/nareix/joy5
        
           | DoctorOW wrote:
           | No I didn't find it in my search for FFMPEG wrappers.
        
         | sam0x17 wrote:
         | Side note the image-rs crate in the Rust ecosystem has no
         | external dependencies and can encode and decode animated gifs
         | and a variety of other image formats, 100% rust
         | https://github.com/image-rs/image. At my startup we use this in
         | a lambda to process user-uploaded images, with great success.
        
           | klodolph wrote:
           | The image-rs crate has some serious design flaws and it has
           | put me off trying to do any image processing in Rust at all.
           | It may support many formats, but the basic image type is
           | complete garbage. It's conceptually a 2D array of some
           | specific pixel type--which means that any pixel value must
           | carry with it colorspace information. I can't honestly
           | recommend it to anyone.
           | 
           | The issues I'm talking about are acknowledged as design flaws
           | / mistakes if you start browsing the GitHub issues.
        
             | aaaaaaaaaaab wrote:
             | Sounds like typical Rust... They're well-meaning people in
             | general, but they usually lack domain knowledge in the
             | particular field they're trying to reinvent in Rust, so the
             | end result often looks like a square-shaped wheel.
        
       | kiernanmcgowan wrote:
       | Awesome work! Projects like this are the gems that keep me
       | excited about hobby software
        
         | crypt0lution wrote:
         | Thanks!
        
       | staunch wrote:
       | Nice! Looks like a good start. As some have noted in this thread
       | there are some issues but nothing you can't fix.
       | 
       | I'd recommend running `go vet -a` and `golangci-lint` on it to
       | see some of the current issues:                 $ go vet -a
       | $ docker run --rm "--volume=$(pwd):/app" --workdir=/app
       | golangci/golangci-lint:latest golangci-lint run
        
         | crypt0lution wrote:
         | Done, thanks!
        
       | unixpickle wrote:
       | I also wrote a similar thing years ago...
       | 
       | https://github.com/unixpickle/ffmpego
        
       | nih0 wrote:
       | correct me if im wrong but lowercase struct fields do not get
       | exported right ?
        
         | kmlx wrote:
         | that's correct: https://go.dev/ref/spec#Exported_identifiers
        
         | crypt0lution wrote:
         | Made a push adding getters for relevant fields and making field
         | names uppercase in the Options struct. Don't know how long it
         | takes for pkg.dev to update, but the issue should be resolved
         | now.
        
           | [deleted]
        
         | dmitshur wrote:
         | Yeah. A good place to see just the exported API (and its
         | documentation) is https://pkg.go.dev/github.com/AlexEidt/Vidio.
        
       ___________________________________________________________________
       (page generated 2022-04-16 23:00 UTC)