Video getting ahead of audio during recording HLS - objective-c

I have a problem where I'm using the Kickflip.io (see code base which is in github) base and building off of it, but after about 10+ seconds the video is getting ahead of the audio. I was able to verify that the audio is playing at the correct rate, so its definitely the video.
I've tried adjusting the sample frame rate for the video down to 10 fps, and this does nothing. Based on all the other audio out of sync with video which is out there for FFMpeg, I'm starting to wonder if there's something in the FFMpeg cocoa pod.
My guess is that the issue is in:
https://github.com/Kickflip/kickflip-ios-sdk/blob/master/Kickflip/Outputs/Muxers/HLS/KFHLSWriter.m

Related

converted .mov file laggs

i have here a rendered .mov video file with the raw codec and 10 frames per second. The video shows a camera that rotates around a house. If I open this file with the Quicktime Player I can move around the house by dragging the mouse over the video. It's like an interactive video.
Now I want to embed this function in my website with javascript. The problem is that I want to use HTML5 videos, so I have to convert the .mov file into .avi or .mp4.
My Problem is now, if I do that the video laggs when I drag with the mouse over it. Even if I just play it it laggs. How can I convert this video so that I have the same quality as in the original?
Thanks in advance,
conansc
You could try using a GOP length of 1 (also known as using all I-frames). This makes it easier to play backwards. But you might need to just turn it into a series of still images, like JPEGs, and swap them to the screen as needed. Video formats are meant to be played forwards, at normal speed.

Video in video.js-Player not displayed correctly

I have a problem regarding a video that is not displayed correctly in the video.js player:
http://www.ulrichbangert.de/kakteen/zeitraffer_vjs.php?Idx=10
As you can see from the page source the dimensions of the player are set to 640x480. The video has the same dimensions which I verified by loading it into my local player and displaying the properties. But: At the left and the right of the video there is a gap of some pixels. The poster is displayed correctly without these gaps. This results in an ugly skip when the player switches from the video to the poster. The poster image is the last frame of the video.
Other videos like this one
http://www.ulrichbangert.de/orchid/zeitraffer.php?Idx=1
are playing fine without a skip but I can't find any difference between these and the faulty one.
My browser is Firefox 23.0.1 thus the ogv video is used.
Can anybody help?
Best regards - Ulrich

MPMoviePlayerController audio/video out of sync

In my iPad App, I create an MPMoviePlayerController that plays an MP4 off of a website. In the MP4 there are people talking. In the App, I have noticed that the audio and video are out of sync by half a second or a quarter-second, perhaps. (I can tell this because I view the video in a web browser and there is no lag.)
The only clue that I have to this is that when the MPMoviePlayerController first loads up, the audio starts playing, but the video doesn't--then the video starts playing and it seems to skip a couple of frames to "catch up" to the audio...but it doesn't quite sync.
Seeing as how this class is a "black box" per the Apple Documentation, and none of the existing methods or properties come across as helpful to this problem, I'm a bit stumped. I may have to leave it how it is with the slight lag, rather than face weird workarounds. I wanted to see if anyone has experienced this before or could suggest a solution.
I'm running on Mountain Lion, latest XCode, iPad 2 with iOS 6.
The code I use to generate the controller is:
-(void) startVideoPlaying {
if (!self.theMoviePlayer) {
self.theMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL: movieURL];
[self.bgView addSubview: self.theMoviePlayer.view];
[self.theMoviePlayer.view setFrame: movieContainer.frame]; // player's frame must match parent's
} else {
[self.theMoviePlayer setContentURL:movieURL];
}
self.theMoviePlayer.shouldAutoplay = YES;
[self.theMoviePlayer play];
}
Thanks for any help.
After a variety of tests, I must conclude that there is something wrong with the encoding on the MP4s that I have been playing. I am not a video codec guru, but I made the following tests, which tell me this:
1) Downloading the MP4, placing it into the app and loading it into the MPMoviePlayerController via a file URL. Audio still out of sync, so not a connectivity issue.
2) Finding another MP4 on the web (something off Vimeo) and streaming it into the Player. Audio synced properly, potentially something wrong with the MP4s I was attempting to play.
3) Downloading the MP4, and using Handbrake to convert it into M4V with a variety of different settings (including the iPad preset). The Audio was synced fine.
Based on this, it seems to me like there's something wrong with the file I was attempting to play rather than the player (or the player can't handle it). Unfortunately, the files I am attempting to play cannot simply be converted, they are part of a large website system and many hundreds of files would have to change, and so on. So, while I have answered my own question, I haven't solved the problem.

Recording audio samples on iOS using AVFoundation

Choosing the audio format in which AVFoundation audio samples are captured.
I am familiar with processing of video frames coming from the iPhone camera. There, the AVCaptureVideoDataOutput's videoSettings property could be used to specify the format in which the video frames should be receievd.
For audio, the similar class AVCaptureAudioDataOutput does not have such a property.
However, the AVAudioSettings.h file clearly shows that there exist several audio formats.
How can I choose a format for audio data? I'm basically interested in raw PCM samples with a certain specific bit rate.
You can try OpenAL. Here is the Documentation. Best regards ;)

Modifying video frames with QTKit and OpenGL

I am working on a project where I would like to open a video (on a Mac) with QTKit. That part I can do no problem, but as I am playing it, I would like to edit or modify the video on the fly using OpenGL.
From what I understand, I should be able to intercept the frames and change them before it hits the display, but no matter what I do, I cannot seem to do so.
It sounds like you should have a look at Core Video and the display link mechanic.
You can basically get a callback on a high priority thread with the decoded frame in a CVImageBuffer and do whatever you like with it (including packing it up as a texture for OpenGL processing and display).
Apple provides documentation and demo code snippets on the developer sites.