Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

Q: Performance #9

Closed
ivanjaros opened this issue Sep 19, 2020 · 2 comments
Closed

Q: Performance #9

ivanjaros opened this issue Sep 19, 2020 · 2 comments

Comments

@ivanjaros
Copy link

ivanjaros commented Sep 19, 2020

Hi, I need to transcode video streams from multiple sources to "normalize" them into single codec and container and whatnot so that I can pass them down the pipeline. ffmpeg is essentially the only player on the market so I have to use it and there is no native Go library for things like this. So I am wondering, from performance point of view, is it better to use CGO and one of the go libraries that map to ffmpeg's C api or to use your project that just uses cli commands to standalone ffmpeg library? I would assume that using the cgo version would be faster but since the cgo is known to be slower than prue go due to the way go and c communicate, maybe talking with standalone ffmpeg binary will be faster? Also how is the concurrency performance? I'll be needeing to process multiple streams at once so I am not sure how standalone ffmpeg handles this. Lastly, is it possible to pipe data through sockets or does it have to go through files or stdout? The examples use directories which concerns me from performance point of view.

@rwilk
Copy link

rwilk commented Sep 23, 2020

I am not an expert (only one project that needs ffmpeg) - but in my case ffmpeg uses all avaiable CPU for transcoding single file, so add extra concurrency have not sense from performance point of view. Keep in mind that spawning many ffmpeg instances at once may have negative impact when you use mechanical disk drive, especially when you use hardware acceleration for transcoding.

@ivanjaros
Copy link
Author

alright, thanks for the info. as for disk lmitation - that is why i asked about sockets, i saw ffmpeg has unix socket support for input and output so i hope it does not touch the disk at all. but i guess that is out of scope of this project.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants