How, in C++, can i convert a video from 1 format to another?
Currently the only way i know how is by using an external exe called FFmpeg and using the function

system("ffmpeg -i file.avi file.mp4");

Recommended Answers

You can use the libraries that ffmpeg uses in your own programs.
See http://www.inb.uni-luebeck.de/~boehme/using_libavcodec.html

Jump to Post

Apparently there isn't, so you'll probably have to review the ffmpeg and/or libavcodec source code.
There doesn't seem to be anything wrong with calling an external program such as ffmpeg or mencoder to do your work.

Jump to Post

All 7 Replies

is there a tutorial somewhere that shows me how to use the functions? i found one tutorial on how to make a video player in sdl with this lib but it did not explain how to do a simple format conversion.

Apparently there isn't, so you'll probably have to review the ffmpeg and/or libavcodec source code.
There doesn't seem to be anything wrong with calling an external program such as ffmpeg or mencoder to do your work.

Well by calling and external program an unwanted console window pops-up and i also cant the progress so that i can display it in anyway i want(ex: a progress bar)

A better way than using system is popen.
Doesn't ffmpeg display its current progress? With popen, you should be able to parse that output and use it to display your own progress bar.

i have never heard of popen, what is the include for it?

popen isn't a standard C++ function, but you'll typically find it as an extension in <cstdio>.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.