Any solution for a video encoder on WP8 ? I have custom camera frames and need to record video from them. But I can't find any video encoder for WP8
Currently there is no API for your question. If you want to do it, the only way is to capture each frame using interval and build your own encoder to encode them. Even with that idea, there is no sound.
Related
I wanted to implement a video quality control in video player in swift.I have used preferredPeakBitRate of avplayer item but I am not able to change the quality of video while the video is playing.I have the manifest file URL that contains different bit rates of video.Kindly suggest me any third party video player that used manual video quality control or tell me how I can achieve using avplayer in swift.
Is it possible to capture the output of the AVPlayer using AVCaptureSession? I believe it's possible but can't figure out how to go about using the AVPlayer as an input.
You cannot plug an AVPlayer into an AVCaptureSession, although you can get access to the player's video and audio in the form of CVPixelBuffers and AudioBufferLists.
This is achieved via two APIs: AVPlayerItemVideoOutput for video and MTAudioProcessingTap for audio.
Despite being a c-api, MTAudioProcessingTap is easier to integrate as just like AVCaptureSession, it pushes you samples via a callback, while with AVPlayerItemVideoOutput you pull frames for a given time.
For this reason, if you want a AVCaptureSession-like experience (real-time, push), you should probably let the audio tap drive your frame-pulling.
There is some AVPlayerItemVideoOutput sample code in objective-c here and in swift here and an example of using an MTAudioProcessingTap in swift here.
I'm looking for a tips to develop an application for iPhone/iPad that will be able to process video (let's consider only local files stored on the device for simplicity) and play it in real-time. For example you can choose any movie and choose "Old movie" filter and want it like on old lamp TV.
In order to make this idea real i need to implement two key features:
1) Grab frames and audio stream from a movie file and get access to separate frames (I'm interested in raw pixel buffer in BGRA or at least YUV color space).
2) Display processed frames somehow. I know it's possible to render processed frame to OpenGL texture, but i would like to have more powerful component with playback controls. Is there any class of media player that supports playing custom image and audio buffers?
The processing function is done and it's fast (less than duration on one frame).
I'm not asking for ready solution, but any tips are welcome!
Answer
Frame grabbing.
It seems the only way to grab video and audio frames is to use AVAssetReader class. Although it's not recommended to use for real-time grabbing it does the job. In my tests on iPad2 grabbing single frame needs about 7-8 ms. Seeking across the video is a tricky. Maybe someone can point to more efficient solution?
Video playback. I've done this with custom view and GLES to render a rectangle texture with a video frame inside of it. As far as i know it's the fastest way to draw bitmaps.
Problems
Need to manually play a sound samples
AVAssetReader grabbing should be synchronized with a movie frame rate. Otherwise movie will go too fast or too slow.
AVAssetReader allows only continuous frame access. You can't seek forward and backward. Only proposed solution is to delete old reader and create a new with trimmed time range.
This is how you would load a video from the camera roll..
This is a way to start processing video. Brad Larson did a great job..
How to grab video frames..
You can use AVPlayer+ AVPlayerItem, it provide you a chance to apply a filter on the display image.
I am trying to capture video from iPhone camera and save the movie mixed with an audio file.
I can capture the video with the audio (from mic) with no problems. What I want to do is capture the video but instead of mic audio, use a music track (a .caf file).
I am capturing the video with AVAssetWriter. I've tried to set up an AVAssetReader to read the audio file, but I couldn't make it work with the AVAssetWriter (maybe because the decoding of audio happens real fast).
Also, I don't want to save the movie without audio and mix it afterwards with an AVAssetExportSession. It would be to slow for my purpose.
Any Ideas ? Thanks in advance.
Capture the video using AVAssetWriter, Capture audio lets say with AvAudioRecorder , then mix audio and video using AVExportSession , lots of posts on this topic.
If you do it after (with AVAssetExportSession) , you will problem with the sync. and short delay (time...) between the video and the audio...didn't find better solution
Is there any way to play mpg files in XNA? (I want to develop a game that a video stream has to play at background)
XNA has built-in video playback. A good place to get started using it might be Catalin's XNA 3.1 Video Sample.
One downside to XNA's built-in functionality is that it has limited format support (specifically WMV9). So you will need to convert your video to that format. Two options for encoding are Windows Movie Maker and Windows Media Encoder (which seems to have recently become Expression Encoder 4).
Once in that format, you can simply add it as content to your project. Then load it as a Video through the content manager, and use VideoPlayer to play it back, calling videoPlayer.GetTexture() to get a texture of the current video frame you can set on the device or pass to spriteBatch.Draw().