Using ffmpeg convert a file from one format to another
usually i do this by command line
ffmpeg -i input.mp4 -vcodec copy -acodec copy out.mkv
here i/p file is input.mp4 which will be converted into out.mkv with having same codec of all elementary stream
NOTE: upper command will only work when the input.mp4 's all codec will be supported by .mkv container.
and if you are not concern with codec then use
ffmpeg -i input.mp4 out.mkv
this will convert mp4 to mkv (if necessary it will also change codec of output format)
Pannu
Updated on May 05, 2020Comments
-
Pannu about 4 years
I'm new to
ffmpeg
and I was trying to find out how to convert a audio or video file from one format to another. I don't want to useCLI
, I just want to know if I can useffmpeg
as a library and call a function to convert a file from one format to another. I went through the documentation and found functionsavcodec_encode_audio
andavcodec_encode_video
but its not clear how I can use this to convert. A tutorial or an example will be very helpful.