Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can you add audio support? #1

Open
rcyboom opened this issue Jun 18, 2020 · 3 comments
Open

can you add audio support? #1

rcyboom opened this issue Jun 18, 2020 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@rcyboom
Copy link

rcyboom commented Jun 18, 2020

example:
addFrame(QImage &img,QByteArray &soundData) or ...

@ju6ge ju6ge added the enhancement New feature or request label Jun 18, 2020
@ju6ge
Copy link
Owner

ju6ge commented Jun 18, 2020

Hey, currently I am pretty busy so I don't have time to add this. And also I don't really have a example in with which I could test this. But I do not object to adding this. If you want to try and add this it should not be to hard. That being said the c interface to ffmpeg is not documented very well. So if you want to take a crack at this I would suggest you look for some ffmpeg audio encoding examples on Github and going from there.

@rcyboom
Copy link
Author

rcyboom commented Jun 19, 2020

I know a little about it,but I don't know how to synchronize the audio and video.

@ju6ge
Copy link
Owner

ju6ge commented Jun 22, 2020

Hm I am also not an expert on audio and video encoding. Doing a quick search gave me this example on how to encode audio with avcodec. So my guess on how to best approch this would be to add an audio_context to the QVideoWriter class. Initialization of this context should be similar to the example, but you might need to a different codec depending in what format your audio data is stored in the QByteArray. The encode function in the example basically is the same as the one I am using, so you don't need to add one for audio. I think adding an addAudioFrame(QByteArray &soundData) function that calls the encoding function with the audio context instead of the video context and which does not increment the frame_cnt variable might just do the trick.

@ju6ge ju6ge added the help wanted Extra attention is needed label Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants