[Solved] How to merging media files with Qt?
-
Hi, I'm new to Qt and this forum, please treat me kindly.
I'm working with many media files that need to be merged together (ogg vorbis, for instance).
Is there any Qt Class that help me doing so? Like using cat:
@cat file1.ogg file2.ogg > file3.ogg@
The result is a file contain sound from the other 2.
Many thanks for those who give me answer!
-
You can achieve this just with "QFile":http://qt-project.org/doc/qt-4.8/QFile.html class: create a file3.ogg then read both file1 and file2 while writing their content into file3.
You can also use "QProcess":http://qt-project.org/doc/qt-4.8/QProcess.html to execute that command but this is OS dependant. -
Be very careful, joining two or more videos as raw files not always works, not all video/audio formats accept a new data stream after it ends, and this method will not work with different formats.
The best way of achieving this, is transcoding the files with, for instance, "FFmpeg":http://ffmpeg.org/pipermail/ffmpeg-user/2012-February/004983.html, you can run FFmpeg through "QProcess":http://qt-project.org/doc/qt-4.8/QProcess.html.