cpp_weekly
cpp_weekly copied to clipboard
Tutorial on how setup, use and run FFMPEG in a program
Channel
"C++Weekly"
Topics
How to setup, use and run ffmpeg in a program. It's really challenging for newbies 😊😊😊like me. Thanks
If it can be in many episode that will be fine.
Length
10-20 minutes
@Gadamatik I do not want to be a gatekeeper here, however, I think ffmpeg has one of the most complete man pages of all, it explains step by step what the program does and it also has examples. You can read it here: https://www.manpagez.com/man/1/ffmpeg/
Also most things that you might want to do using ffmpeg, you can search for them and you might find a tutorial/forum that explains how to do that.
I'll write a more less comprehensive “Getting started” guide so you can understand better the manual:
ffmpeg [reading/decoding_options...] -i input_file [writing/encoding_options...] output_file
Before dong something with any file, you might want to see what is inside (a video usually is a bundle of stream
s of audio, vision and subtitles), so for that, you only do:
ffmpeg -i input_file
This will tell you enumerate the file stream
s and will tell you some details.
If you want to manipulate the stream
s of multiple files you might check them with:
ffmpeg -i input_file1 -i input_file2
You will notice that the stream
s have an indexing of the form n:m
that means the n'th file, the m'th stream
You may manipulate the first stream of the first file with the option -map 0:0
Now, the important thing here that for each stream, you will se the info of how it was encoded, so then you can use the:
ffmpeg -codecs
To see which would be the best codecs to decode the streams (some uses gpu's some are only available with some specific non-gpl-friendly compilations, etc). same for how you want to encode them. if you don't want to modify the stream
there is always the self-explanatory copy
codec (useful if you are only trimming files, for example).
If you understand this, the man pages should be easier. After reading this and checking the manual, if you still have a more specific question, ask that in a forum.
Hello @fcolecumberri ,
Thanks for your kind reply and I really appreciate it. I already install it and I know some point (obviously not like you), even if I'm beginner. But I'm looking for a way on how to use the ffmep library itself in program to take advantage of.
I already tried to read the "famous" tutorial on Dranger . But I quickly understand that it is outdated. I got a bunch of undefined reference
when linking with my hello ffmpeg
program. And so far, I'm aware of how to link a library.
So to not be long on this comment, that's why I asked for help and I know whatever passed under the hands of @lefticus, it become clear for anybody.
Best Regards
Looks like the man page is for cli and I think @Gadamatik want's the c++ api? Some resources to get you started are:
- https://github.com/leandromoreira/ffmpeg-libav-tutorial#chapter-0---the-infamous-hello-world
- https://github.com/denesik/ffmpeg_video_encoder
- https://www.youtube.com/watch?v=HVkcdhqWp5s
Happy new year 2024.
@JonathanHiggs are completly right, It's that I want... But with the touch of @lefticus on it...