Azure Media Service video encode with rotation - azure-media-services

I have videos recorded with phone in portrait and need to encode them with 90, -90 or 180 degree rotation.
Encoding presets doesn't seem to have this option.
http://msdn.microsoft.com/en-us/library/windowsazure/jj129582.aspx
How to define encoding rotation for video asset?
Edit:
Got answer from Media Services forum. Its not supported at moment.
http://social.msdn.microsoft.com/Forums/en-US/MediaServices/thread/68090985-b1ad-4d52-bb08-c4386654c1b9

Related

iPhone headphone output - mono control left / right ear

I'm working on an iOS6 and above GPS navigation route creation and following app. At the moment I've integrated the OpenEARS framework to provide text to speech directions to the user.
I have setup an AVAudioSession and overrode the audio category to headphones. I'm looking for some advice in limiting my audio output to the left / right headphone channel depending on what physical direction the user must travel to reach the destination.
This is my first foray into Audio on iOS and am happy to change from OpenEARS if someone has knowledge of completing this with another TTS library.
Thanks, Ben
To anyone it may help in the future...
After spending hours looking at Core Audio and AudioToolbox methods for balancing I stumbled over a pan property within AVAudioPlayer. OpenEARS, and ultimately Flite, TTS systems use the AVAudioPlayer to play the converted audio file. Cheers!
The audio player’s stereo pan position.
#property float pan Discussion By setting this property you can
position a sound in the stereo field. A value of –1.0 is full left,
0.0 is center, and 1.0 is full right.
Availability Available in iOS 4.0 and later. Declared In
AVAudioPlayer.h

Right choice to play audio and video content

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.

Orientation issue with mobile recordings

When I convert .mov files from iPhone 4 and .3gp from Android with FFMPEG.
I need to rotate the video 90 degress, but iPhone 4s needs 180 degress...
Is there any way to fix this?
I don't recall how Android handles this, but iPhones record orientation information in the mov file metadata. Depending on how the camera is held while recording, videos could need 0, 90, 180, or even 270 rotation to play upright after conversion. As yet, I don't know of any additions to ffmpeg to parse this metadata, so you have to do it manually using ffprobe -show_streams or something similar, and then set the rotation appropriately.
Update: as kibitzer points out ffmpeg does now detect that the video is rotated, but does not yet provide an automatic rotation fix. Instead, you'll still have to parse out the rotation information and use a combination of the transpose, vflip, and hflip video filters to correctly rotate the video.
Newer ffmpeg returns a rotate: metadata header (when you run ffmpeg -i), which specifies an angle that the video was rotated, so you don't have to parse the rotation matrix yourself and can just rotate the video by using ffmpeg's filters.
For example, if ffmpeg output rotate: 90 then you would run something like:
ffmpeg -y -i rotated_vid.mov -vf "transpose=1" correct_video.avi
I use a program called mediainfo who show the orientation angle and put in the ffmpeg options:
-vf %ROTATE%
ffmpeg in 95% of the cases understand the orientation but there are some cases, in some hardwares...

Camera differences between UIImagePickerController and AVCaptureSession on iPhone

I'm trying to build a replacement for UIImagePickerController, using AVCaptureSession with AVCaptureDeviceInput and AVCaptureStillImageOutput, as input/output respectively.
To preview the camera stream I'm using AVCaptureVideoPreviewLayer.
It's now working correctly for capturing and storing photos just like the default camera.
However, I found 3 problems I was unable to solve:
photos captured don't get the same quality the default camera provides
the viewing/capture angle is shortened, just like using the video capture on the default camera
no way to control camera specific options like flash
Is there any way to get to the level of UIImagePickerController using a more customizable approach (i.e. AVFoundation or any other)?
Check out "Session 409 - Using the Camera with AV Foundation" in the WWDC 2010 videos. Based on the video, it looks like you can resolve all three of your issues with AVFoundation.
Hope this helps!

FFmpeg on iPhone - Modifying Video Orientation

I'm messing with h264 videos loaded with FFmpeg on the iPhone 3GS. The problem is any videos recorded in "Portrait" orientation have a transformation matrix applied to them causing them to display rotated 90 degrees counter-clock.
From what I understand thus far, I just need to modify the transform matrix in the 'tkhd' atom. The problem is I am having trouble accessing or modifying this data. I checked out the FFmpeg implementation for:
static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOVAtom atom)
which clearly shows how the matrix is accessed in avformat but when I try to access the header bytes using the same functions I am not getting any rational values. Even if I were to successfully pull the matrix I'm not sure how to replace it? FFmpeg has functions for retrieving and appending to the track header but nothing for replace it seems?
Any help would be greatly appreciated.
Thanks,
Matt.
To those who cannot get the v filter option to work, after some searching I found an alternative option which works for my build:
ffmpeg -i in.avi -vf "transpose=1" out.avi
this flips the video 90 degrees clockwise. hope this helps all those on ubuntu struggling like I was!! :)
I just had a patch accepted on the FFMPEG git master branch which should help all of us in adjusting for the iPhone's orientation and subsequent transform applied to the .mov file it sends out. FFMPEG will now send back in metadata:
'rotate'=90,180,or 270 depending on how many degrees you need to turn the image clockwise to get the true rotation.
Portrait video recorded in iPhone 3GS is strangely rotated in landscape, and only quicktime plays it correctly, players like VLC etc play the portrait mode videos in landscape because it is encoded that way! Maybe apple have set some bit so that quicktime identifies and sets the orientation properly.
You can use -vfilters option of ffmpeg to rotate the video. It is available in version r21242. You have to patch it on your version of ffmpeg.
configure the build by using --enable-vfilters
and you can use the option:
ffmpeg -vfilters "rotate=90" -i input.mp4 output.mp4
to rotate the input movie.
the movie is recorded directly with the orientation of the hardware camera. when you turn it the camera still records with the same orientation and the same straight write to file.
What determines the orientation of the video is the Transform matrix
The matrix is set dependent on the iphone's orientation. And this is what will determine if you have to rotate the video. And that rotation could be 90 degrees and it could be 180 degrees. It depends on the phone orientation.
After you get an idea of what the matrix is and how it relates to the image you will be able to determine the orientation of the video.