EX/P4-09 Rotation Braking and Error Field Correction of the Test ...
Video rotation correction
-
Upload
foxlink-csbg-software -
Category
Technology
-
view
5.550 -
download
0
Transcript of Video rotation correction
Video rotationVideo rotation correctioncorrection
Author : Fred HsuDate : 2011/08/31
Problem StatementProblem StatementVideo player does not support
auto rotation according to sensor.Video player shows different
orientation from our video recorder.
Control B
ar ARecorded asportrait
style
Remove fixed orientation of Remove fixed orientation of layoutlayoutMarvell provides a fixed layout
screen orientation on video player of Gallery3D app.
Remove fixed orientation video player of Gallery3D app AndroidManifest.xml◦<activity …
android:screenOrientation="landscape" > … </activity>
ResultResult
0 degree
Control Bar
A
A
Portrait
90 degree
270 degree
Landscape
Reverse
Landscape
Control Bar
A
Control Bar
Rotation compensationRotation compensationCheck recorder files : The three
orientations are the same as previous page shows.
We need to do a rotation compensation for video player.
First stage : trace video First stage : trace video recorder rotation parameterrecorder rotation parameterAndroid provides a MediaRecorder object
for video/audio recording usage.MediaRecorder. setOrientationHint
method set the rotation degrees to recorded file.
Android developer website :◦ This method will not trigger the source video
frame to rotate during video recording, but to add a composition matrix containing the rotation angle in the output video if the output format is OutputFormat.THREE_GPP or OutputFormat.MPEG_4 so that a video player can choose the proper orientation for playback.
MediaRecorder MediaRecorder setOrientationHint flowsetOrientationHint flow
JavaMediaRecord
er
Jniandroid_media_MediaRec
order
FrameworkMediaRecord
er
IPCFrameworkIMediaRecor
der
FrameworkMediaRecorderCli
ent
FrameworkStagefrightRecor
der
Store rotation degrees
MPEG4Writer
Convert to Composition matrix
Check composition Check composition matrix(1)matrix(1)MP4 file standard defines a
composition matrix, order { a, b, u, c, d, v, x, y, w }
| a b u | | c d v | | x y w |0 degree : a = 0x00010000, b =
0x00000000, c = 0x00000000, d = 0x00010000 (Recorded as landscape)
Check composition Check composition matrix(2)matrix(2)90 degree : a = 0x00000000, b =
0x00010000, c = 0xFFFF0000, d = 0x00000000 (Recorded as portrait)
270 degree : a = 0xFFFF0000, b = 0x00000000, c = 0x00000000, d = 0xFFFF0000 (Recorded as reverse-landscape)
Second stage : trace video Second stage : trace video player rotation parameter(1)player rotation parameter(1)Video player create flow:
Trace the video player (Here we use StagefrightPlayer) : find out the composition matrix will get from recorded file.
JavaMediaPla
yer
Jniandroid_media_MediaPl
ayer
Framework
MediaPlayer
FrameworkMediaPlayerServ
iceVideo Player
IPC
Second stage : trace video Second stage : trace video player rotation parameter(2)player rotation parameter(2)
StagefrightPlayer
3gp file headercomposition
matrix
libstagefrighthw
Convert to degrees
Create renderer with degrees
Display with rotation
ISurface
Part of stagefright system
Surface system
Overlay
Video Device
Overlay system
Q & AQ & A