devopvoid / webrtc-java

WebRTC for desktop platforms running Java
Apache License 2.0
248 stars 60 forks source link

How to save a video that contains sound? #79

Closed ChdDongyang closed 1 year ago

ChdDongyang commented 1 year ago

Now, I can save video and audio separately, and then use tools such as ffmpeg to process it. I want to know whether it is possible to save the video containing audio directly, instead of saving the videoframe as a picture, then synthesizing the video, and finally adding the audio track. Thank you very much!

Charles92011 commented 1 year ago

@ChdDongyang The tracks that come in via WebRTC only contain raw media data. To put them together into a single file, you'll need to compile them using a codec of some sort. I think it's outside the scope of this project.
If you'd like to move this to the discussion area we could open up the conversation and work on this.

ChdDongyang commented 1 year ago

Thanks your reply. I'm a beginner in the field of audio and video processing. I don't know that in the onTrack method, I can only receive video and audio separately. I will study this knowledge more deeply. Be more cautious when proposing issue in the future.

Charles92011 commented 1 year ago

@ChdDongyang check out my project: https://github.com/Charles92011/webrtc-java-experimental-server
It's a server designed specifically for experimenting with webrtc-java, it has examples of how to save audio and video. You should be able to insert a pot-processing phase to marry the two together.

ChdDongyang commented 1 year ago

@Charles92011 Thank you very much, I get it !