-
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
Audio out of sync #321
Comments
Make sure to call |
Im doing this: recorder.start();
Frame capturedFrame= null;
while( keepRunning && (capturedFrame = grabber.grabFrame(audio,video, true, false)) != null ){
recorder.setTimestamp(grabber.getTimestamp())
recorder.record(capturedFrame); and getting errors like:
and
|
That probably means you're trying to use a different frame rate. If you need to convert the frame rate, try to use |
How do I use FFmpegFrameFilter for that case? |
Try to use it as shown in issue #164 (comment) but with the |
is this correct or should I leave out the timestamp part? fpsFilter = new FFmpegFrameFilter("fps=fps=25",width,height)
recorder.start()
fpsFilter.start()
Frame capturedFrame= null;
while( keepRunning && (capturedFrame = grabber.grabFrame(audio,video, true, false)) != null ){
fpsFilter.push(capturedFrame)
capturedFrame = fpsFilter.pull()
recorder.setTimestamp(grabber.getTimestamp())
recorder.record(capturedFrame);
} |
You're missing a loop in there, and we'll need to pass the timestamps to FFmpegFrameFilter as well, somehow... I didn't think about that... |
fpsFilter = new FFmpegFrameFilter("fps=fps=25",width,height)
recorder.start()
fpsFilter.start()
Frame capturedFrame= null;
while( keepRunning && (capturedFrame = grabber.grabFrame(audio,video, true, false)) != null ){
fpsFilter.push(capturedFrame) //--> before this we should be calling fpsFilter.setTimestamp(grabber.getTimestamp)?
Frame frame = null
while ((frame = fpsFilter.pull())!= null){
recorder.setTimestamp(grabber.getTimestamp())// <- so here we would need fpsFilter.getTimestamp?
recorder.record(frame);
} So currently there is no way to synchronize audio and video or is there another option?
|
You could simply drop the frame when |
Ok so I keep fpsFilter, and instead of: or do you mean I should remove fps Filter completely? |
Do something like that without the fps filter, yes.
|
Ok thanks alot will try that |
while( keepRunning && (capturedFrame = grabber.grabFrame(audio,video, true, false)) != null ){
if(!(recorder.getTimestamp() > grabber.getTimestamp())){
recorder.setTimestamp(grabber.getTimestamp())
recorder.record(capturedFrame)
}else log.info("drop Frame!")
} I did that now all video Frames are being dropped :/ but sound is getting through |
Well, do you see anything in FFmpeg's log that might indicate problems with the timestamps? |
No Messages at all. If I leave out the setTimestamp(grabTimestamp) it works for same framerate |
So it looks like a problem with variable frame rates. Try to use different formats and codecs. |
Hi Im having the problem that when I try to transcode a live stream into another live stream audio and video are out of sync. Any ideas why that is and how it can be fixed?
Its happening for many different input streams.
My version is 1.1
code is default im using FFMpegFrameGrabber and FFmpegFrameRecorder
The text was updated successfully, but these errors were encountered: