I'm working on an app that create a video from a collection of frames using AVFoundation, adds an audio track and uploads to Facebook. I've previously had this working successfully, but it now appears to be failing and I can't find the issue with the format of the video.
An example video is available here: http://www.sendspace.com/file/6p8u11
It should be a Quicktime movie with H.264 and AAC audio. This ought to be ok, but perhaps something about the frame size or frame rate are an issue?
Hope someone can help.
Thanks,
J
Related
I am developing a game for android and ios via Unity. I have to play a video in a scene in the game and I use the video player component for this. I get the video link on local using xampp. And the video I'm trying to play is in mp4 format. But when I start the game, the video cannot be played properly. I am not getting an error, but video looks like the picture I send. I don't know what I'm doing wrong, can you help me? I also share the code I used and related pictures with you.
public VideoPlayer videoplayer;
public string videoUrl="urlgir";
void Start() {
videoplayer.url = videoUrl;
videoplayer.audioOutputMode=VideoAudioOutputMode.AudioSource;
videoplayer.EnableAudioTrack (0, true);
videoplayer.Prepare (); }
I think I found something. I uploaded the video I mentioned to unity again. I got a warning after uploading the video.
VFR warning: 1111 video frames have a different duration than expected 0.0333333s, ranging from 0s to 1.2771s.D:/Program Files/Unity/xxx/Assets/Scenes/hp.mp4 (30FPS) may have variable frame rate (VFR), which is not supported. This may lead to incorrect timing in transcoded clip.
I think the video has unsupported variable frame rate. So I can't run the video as clib or url. Well, does anyone know of this warning? What should be needed?
I want to repeat 1s video to 10 seconds. I used AVMutableComposition and attached the code below.
When I try with a video recorded by apple default camera app, it works as well.
But I need to have specified video so that I made a customized camera. I made 1s video(frame rate : 5fps, H264 codec).
I am getting black frames with this video.
I am not sure whats the problem. Please help.
I solved it by myself so I did not translate target view's coordinator when apply transform to video track so that it doesn't show up properly.
Is it possible to add time stamp on the video screen while recording a video using camera?
Can we add timestamp on existing video's screen and remove audio from existing video?
I have searched over the internet, but couldn't find a clue, any guidance with reference tutorials please ?
Thanks
Apple has provided sample for video editing. You can check that.
The AVEditDemo sample is in the WWDC 2010 sample code pack
Thanks,
Im building an app that allows the user to record a video (in app) by pressing a button on the main screen. I don't want the user to be taken to the photo app because the video will only be able to be viewed on the app (Max of 15 seconds) and I can't quite get it. Anyone have the code to do this? A good example of what i want the camera to do is the camera in the app Cinemagram. Thanks for any help.
If you plan on saving the movie to the user's photo library, then you can use UIImagePickerController. In particular, you should read the guide that accompanies the class.
However, if you only want the video to be temporary, then you will probably want to use AVFoundation. You would then need to configure an AVCaptureSession with an AVCaptureMovieFileOutput to write the video to disk. Then, when you are ready to play the video, create an AVURLAsset with the file url that you just wrote, use that to create an AVPlayer to play the video, and add an AVPlayerLayer to your view, with said player, to display the video.
Either way, I would recommend studying the examples that Apple provides.
AVCam and
AVPlayerDemo should be more than enough to get you started (especially the AVCam example project).
What I'm doing :
I need to play audio and video files that are not supported by Apple on iPhone/iPad for example mkv/mka files which my contain several audio channels.
I'm using libffmpeg to find audio and video streams in media file.
Video is being decoded with avcodec_decode_video2 and audio with avcodec_decode_audio3
the return values are following for each function are following
avcodec_decode_video2 - returns AVFrame structure which encapsulates information about the video video frame from the pakcage, specifically is has data field which is a pointer to the picture/channel planes.
avcodec_decode_audio3 - returns samples of type int16_t * which I guess is the raw audio data
So basically I've done all this and successfully decoding the media content.
What I have to do :
I've to play the audio and video accordingly using Apples services. The playback I need to perform should support mixing of audio channels while playing video, i.e. let say mkv file contains two audio channel and a video channel. So I would like to know which service will be the appropriate choice for me ? My research showed that AudioQueue service might be useful audio playback, and probably AVFoundation for video.
Please help to find the right technology for my case i.e. video playeback + audio playback with possible audio channel mixing.
You are on the right path. If you are only playing audio (not recording at all) then I would use AudioQueues. It will do the mixing for you. If you are recording then you should use AudioUnits. Take a look at the MixerHost example project from Apple. For video I recommend using OpenGL. Assuming the image buffer is in YUV420 then you can render this with a simple two pass shader setup. I do believe there is an Apple example project showing how to do this. In any case you could render any pixel format using OpenGL and a shader to convert the pixel format to RGBA. Hope this help.