bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.51k stars 1.58k forks source link

how to add new audio channels to mp4 which already have audio channels #1940

Open ggslayer opened 1 year ago

ggslayer commented 1 year ago

Hi, I want to mix a new audio channels(backgound music) to mp4 file which already have two audio channels, I think this refer to how to mix the existing and new audio channels, I have no idea how to accomplish this purpose, can you give me some advise? thank you! If there is some example code, that's perfect! thank you ~~

saudet commented 1 year ago

You could use a filter: https://ffmpeg.org/ffmpeg-filters.html

ggslayer commented 1 year ago

Hi, I don't want to use ffmpeg cmd method to archive this, In my situation , I must frame by frame to done this, (there is a lot of code already writen), I want to use ffmpegframegrabber / recoder /frame's direction, And do some sample data operate to archive this, can you give me some help about this direction? or use FFmpegFrameFilter? Is there some example about my audio mix purpose?

saudet commented 1 year ago

Again, there are a couple of examples of FFmpegFrameFilter in the samples, but we can use any other filter command: https://github.com/bytedeco/javacv/tree/master/samples

ggslayer commented 1 year ago

ok I'll try it, thank you