1

We need ffmpeg to do some video processing, like video format conversion, live stream snapshot..., we won't go deep in ffmpeg.

Now I am wondering what would be the better way to use ffmpeg, we are developping in Golang, either we call ffmpeg like shell command line, or we use libav* library of ffmpeg.

command line:
    Pros: 
        easy to use, reliable (I got a quality loss problem with library mode), many tutorials
    Cons:
        the is is a separate process, out of our control, we can't get detailed information of the process, like the video conversion progressing data
        the command line way seems not so cool, this is not well integrated in the whole project.

libav* library:
    Pros:
        we can have the process detailed data, progressing status....
        ...

    Cons:
        difficult to use, much less materials

Could anyone give your idea which is the better way to use ffmpeg?

Before this question, I have asked another two questions:

One is regarding calling libav* library caused the qulity loss problem:
Why calling libav* library doesn't have same quality as ffmpeg command line?

One is for command line progressing status retrieving problem:
How to get the realtime output for a shell command in golang?

Community
  • 1
  • 1
seaguest
  • 2,510
  • 5
  • 27
  • 45

1 Answers1

0

I would say it all depends on your needs:

Your comparison between the two is quite reasonable. Moreover, with ffmpeg library, you can even implement your own code, then you are not just a ffmpeg user but a developer: you can get access to ffmpeg internal implementations which sometimes aren't provided as APIs or presented through commandline tool to users.

So if you are going to program your own software or integrate ffmpeg to other programs, then maybe the library is a better way to do that. (In your case to program ffmpeg APIs in Golang...)

Commandline tool is easier to use, but the functionalities are already fixed there. Therefore it's less flexible for a programmer. However, it will provide you some instant results. For instance, you can get a stream info virtually immediately via commandline or you can save a frame efficiently with appropriate parameters. Commandline is a good tool to gain quick results for further analysis, so to speak...

Kindermann
  • 403
  • 1
  • 7
  • 17