hi guys i have been trying to record a video with front camera and the playing it back using the videoview and mediacontroller. But facing the orientation problem, as i record the video with camera orientation set to 90 degree(PORTRAIT) but when the recorded video is played it doesnot play in PORTRAIT mode instead it plays in landscape mode. Also have tried setting the media recorder object's setOrientationHint method to 180 degree. Still with no success. Hope someone could have faced or solved this issue and hoping for better responses. Thanks in advance. If needed i can post my code snippets too.
rotate videoview to 90 degree.
Related
I am recording a video using android MediaRecorder
mMediaRecorder.setOrientationHint(degrees);
I used this to rotate the video. It records in correct orientation and MXplayer plays this in correct orientation. The problem is the vlc player and other players are not playing it in the correct orientation.
Can anyone help me on this ?
Thanks in advance.
I am working on an app in which I want to implement video recording feature in which user can switch the camera from front to rear and vice versa (like snap chat) while recording.
I have implemented the function of switching camera, the video is getting recorded as well, but the problem is my video is getting blank/stuck from the point of switching.
I have tried with this solution but it is not working in my case.
Is there any other way to achieve this?
Thank you.
I'm building a custom camera to record video. The camera displays the preview correctly and records the video correctly as well. The problem is with the saved video. The recording is in the wrong orientation(sideways), and I know it's being recorded this way because I'm using a third-party app to playback the video. I've solved it temporarily with this line:
mRecorder.setOrientationHint(270);
However, I'm not sure that this will work on all devices. My question is, what's a more reliable solution to my problem?
Edit
This problem only happens when I record in portrait, when I record in landscape, the orientation is already correct and I don't have to use setOrientationHint
Edit 2
That question is about fixing the preview orientation, I've already solved that problem. My question is how to fix the recording orientation i.e. the orientation of the saved video. –
I have problem with rotate video in Android. I used TextureView to rotate the video but it didn't work fine. It show black screen on device Android 4.2.2. Any body have idea for rotate video? such as use SurfaceView. Please help me.
Thanks.
A Video in Android can be rotated by using the following code:
videoView.setRotation(90f);
videoView.setVideoURI(videoUri);
videoView.start();
I used the above code to rotate a video for my app
When playing back videos on the Samsung Galaxy S4 the video does not recognize the orientation metadata. It always plays on landscape.
The app also records the video and plays correctly on all other devices while streaming. The S4 plays it fine only if the video is stored in the device but it won't work for streaming.
Using MediaPlayer and SurfaceView on a Fragment, not a VideoView.
Have tried to disable Air View, Air Gesture, Smart Stay, Smart Scroll and Auto Rotate without luck.
Also even stored the orientation hint along with the video to rotate manually the element in the layout, but the SurfaceView when rotated using lockCanvas doesn't work and when rotating its parent element goes black and only plays the audio.
Any suggestions I can try to get this bug fixed? Have you experiencing the same when using the S4? Any help on this will be greatly appreciated. Thanks!
I asked this question a few months back and haven't heard anything. I would love to know as well.
https://stackoverflow.com/questions/17950072/galaxy-s4-media-player-ignores-rotation-metadata
Edit: This also occurs on the Galaxy Note 3.
Found a workaround for this issue. Try using a TextureView instead a SurfaceView, before playing the video, get the rotation info with MetadataRetriever and adjust the TextureView as needed. It worked on this side.
See the details here:
Streaming Video Playback Orientation Issue # Samsung Developers Forum