Git Product home page Git Product logo

Comments (9)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
(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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.