-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
How to play audio with javacv? #820
Comments
Which sample are you referring to?
|
Here's part of my code:
|
I see. That sample needed to be updated since issue #18 has been fixed. I've done so in the latest commit above and now it works. Enjoy! |
@saudet Thanks for the commit! The audio is working now, but I am countering another problem.
Should I user two thread to capture video and audio and user the third thread to send the data, or send the data after recording a frame without caring about audio, or send the data every time the recorder encoded a video or audio? |
We can do anything we want. What issue are you facing?
|
When I record video only or audio only it works well. But if I use one record to encode both video and audio and transmit it, the performance is not very good.
|
I'm not sure I understand, just encode everything as soon as you get it...?
|
I do encode everything. But when I am trying to get the data I am not sure that I get only one image/audio frame cause I am not sure that the recorder is not writing another audio/image data into the stream. |
That's not an issue, we're supposed to encode both together, just like this:
https://github.com/bytedeco/javacv/blob/master/samples/RecordActivity.java
|
I think I got this fixed... |
I followed the samples on github, which use:
When I run the code there is an exception says that cannot convert
DirectShortBufferU
toFloatBuffer
.I also tried
frame.samples[0].array()
and there is another exception. I googled and find that although this DirectShortBufferU extends ShortBuffer but there is no method array().I tried some other ways too, but the audio quality is unsatisfying (actually very bad). Any ideas on how to fix it?
Thanks!
The text was updated successfully, but these errors were encountered: