Comments (9)
It seems like it should work if the imageWidth and imageHeight is 0 so that it
would call super.getFrameNumber(), but it is always returned 0 since it was
never incremented in super.
Original comment by wzsddtc
on 14 Jun 2013 at 4:51
from javacv.
(also note that audio_c.frame_number() is always much bigger than
picture.pts().. not sure which one to use. )
Original comment by wzsddtc
on 14 Jun 2013 at 5:21
from javacv.
The following change works. :)
private int audio_clock;
@Override
public long getTimestamp() {
if (picture == null) {
return (audio_clock * 1000000L) / sampleRate;
} else {
return Math.round(getFrameNumber() * 1000000L / getFrameRate());
}
}
boolean record(AVFrame frame) throws Exception {
int ret;
av_init_packet(audio_pkt);
audio_pkt.data(audio_outbuf);
audio_pkt.size(audio_outbuf_size);
if ((ret = avcodec_encode_audio2(audio_c, audio_pkt, frame, got_audio_packet)) < 0) {
throw new Exception("avcodec_encode_audio2() error " + ret + ": Could not encode audio packet.");
} else {
if(frame != null){
this.audio_clock += frame.nb_samples();
}
}
Original comment by wzsddtc
on 14 Jun 2013 at 6:16
from javacv.
Hi wzsddtc,
I have same problem that images and it is much slower than audio recording, So
would you please advice me to fix this problem, maybe some sample code(I'm very
newbie in development).
Thanks so much!
Original comment by [email protected]
on 19 Jun 2013 at 11:10
from javacv.
Yes, you are right, forgot about timestamps of audio frame. Should be fixed
with this update:
http://code.google.com/p/javacv/source/detail?r=a38bec82311333d7ae7d06decdd4a2af
e7c92455
Thanks!
Original comment by [email protected]
on 22 Jun 2013 at 3:59
- Changed state: Started
from javacv.
Thanks for the update. This should be added to FFmpegFrameRecorder as well, do
you know how to set a timestamp on the audio track (to skip audio samples) in
addition to the frame number?
Original comment by wzsddtc
on 22 Jun 2013 at 5:46
from javacv.
Are you really talking about FFmpegFrameRecorder? I'm not sure I understand the
use case then. I'm also not sure about the technically feasible of what you are
asking. Do you have any reference about what it is exactly you are looking to
accomplish? A message thread from the FFmpeg mailing list perhaps? Thanks!
Original comment by [email protected]
on 23 Jun 2013 at 12:00
from javacv.
This case should be closed. Audio timestamps can be grabbed by calculating how
many samples are calculated already in FFmpegFrameRecorder OR how many samples
are grabbed in FFmpegFrameGrabber. :)
Original comment by wzsddtc
on 16 Sep 2013 at 5:06
from javacv.
Ok, sounds good :) I was under the impression that you were trying to skip
audio frames on record(). This makes sense for video (we get variable frame
rate), but I wasn't sure how that would make sense for audio...
Original comment by [email protected]
on 16 Sep 2013 at 5:24
- Changed state: Fixed
from javacv.
Related Issues (20)
- FFmpegFrameGrabber won't grab till the end of video. HOT 12
- Conversion of audio in FFMpegFrameGrabber HOT 6
- Cached value of CvMat.fullSize and *Buffer fields might get incorrect HOT 85
- Missing default metadata in FFmpegRecorder HOT 4
- .so files gets deleted on Build&Run (Android) HOT 4
- Execution error HOT 1
- capture problem HOT 4
- Clear documentation on how to use callbacks from FFMpeg and OpenCV in JavaCV using JavaCPP HOT 30
- Memory leaks HOT 2
- Cannot find class file javax.swing.JFrame HOT 1
- FFMpegFrameRecorder is sending an unusually high keyframe rate HOT 4
- IPImage's use of awt classes are causing crashes on some device. HOT 1
- cvSetImageROI() and cvWarpAffine() made false color image HOT 15
- EXCEPTION_ACCESS_VIOLATION HOT 2
- cvLoadImage is not work in my android app HOT 15
- Problem using ffmpegframegrabber with a remote camera that needs login HOT 2
- Reconnect problem on Android HOT 1
- Problems with android devices having Android 3.0 or lower version but works well with Android 4.0 and higher version HOT 5
- error: javacv for android on eclipse
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javacv.