Android Question Horizontal Flip of Video

tito

Member
Licensed User
Longtime User
Hi b4x Team,

I'm developing an app where the user records himself via video with the front camera (selfie-mode) for a defined duration.
During record time the view is flipped/mirrored. Thats good.
After the timer has elapsed the video is running/replay automatically.

This all works good but the video is not flipped in play-mode (what should be the normal case :)).
In my special case I need also the video flipped/mirrored in play-mode, so that it has the same orientation for recording(preview) and replay.

Does anyone has an idea how to flip the result video file during recording or manipulating/preprocess it after the record is done?
already looked into SimpleMediaManager but without any success :(

I'm also fine if there is a possiblity to just show the video horizontal flipped in a VideoView without touching the raw video file ;)

Many Thanks
-Timo
 
Last edited:

tito

Member
Licensed User
Longtime User
For capturing I took the the simple camera2 example and switched to the front cam

B4X:
Sub CaptureVideo
    
    Try
        SetState(openstate, True, VideoMode)
        If cam.RecordingVideo = False Then
            mSubs.ActMode = mSubs.eMode.Record
            cam.StartVideoRecording (MyTaskIndex)
        Else
            cam.StopVideoRecording (MyTaskIndex)
            File.Copy(mSubs.VideoFileDir, "temp-" & mSubs.VideoFileName, mSubs.VideoFileDir, mSubs.VideoFileName)
            'ToastMessageShow($"Video file saved: $1.2{File.Size(mSubs.VideoFileDir, mSubs.VideoFileName) / 1024 / 1024} MB"$, True)
            Wait For (PrepareSurface) Complete (Success As Boolean)
            SetState(openstate, False, VideoMode)
        End If
    Catch
        HandleError(LastException)
    End Try
    
End Sub

and playback in a simple VideoView

instead of flipped playback is it possible to do a flipped record like in the front cam preview?
 
Upvote 0

tito

Member
Licensed User
Longtime User
Hi Erel,

thanks for the example. Thats exactly what I need!
Perfect support :)
 
Last edited:
Upvote 0
Top