RenderHeads / UnityPlugin-AVProMovieCapture

AVPro Movie Capture is a Unity Plugin for advanced video capture to AVI/MP4/MOV files
https://renderheads.com/products/avpro-movie-capture/
49 stars 8 forks source link

iOS in portrait, captured video is landscape #339

Closed helferapp closed 12 months ago

helferapp commented 1 year ago

Hi, I'm using iOS device in portrait mode, capturing a video from WebCamTexture

        cameraInstance.texture = new WebCamTexture(cameraInstance.name, 720, 1280, 30/*FPS*/);
        cameraInstance.texture.requestedWidth = 720;
        cameraInstance.texture.requestedHeight = 1280;
        cameraInstance.texture.requestedFPS = 30;
        cameraInstance.texture.Play();
        if (cameraInstance.texture.isPlaying)
        {
            GameObject go = new GameObject();
            cameraInstance.capture = go.AddComponent<CaptureFromWebCamTexture>();
            Codec h264Codec = CodecManager.FindCodec(CodecType.Video, "H264");
            Codec aacCodec = CodecManager.FindCodec(CodecType.Audio, "AAC");
            if (h264Codec != null && aacCodec != null)
                Debug.Log("Codecs found");
            // Assign a specific codec for capture
            cameraInstance.capture.NativeForceVideoCodecIndex = h264Codec.Index;
            cameraInstance.capture.NativeForceAudioCodecIndex = aacCodec.Index;
            cameraInstance.capture.IsRealTime = true;
            cameraInstance.capture.OutputTarget = OutputTarget.VideoFile;
            cameraInstance.capture.OutputFolder = CaptureBase.OutputPath.RelativeToVideos;
            cameraInstance.capture.FilenamePrefix = shortVideoFileName;
            cameraInstance.capture.FrameRate = 30;
            cameraInstance.capture.StopMode = StopMode.None;
            cameraInstance.capture.WebCamTexture = cameraInstance.texture;
            cameraInstance.capture.AudioCaptureSource = AudioCaptureSource.Microphone;
            cameraInstance.capture.ForceAudioInputDeviceIndex = MicId;//default
            cameraInstance.capture.CompletedFileWritingAction += OnCompleteFinalFileWriting;
            /* this will not work on iOS
             * //video is saved landscape, when I insert these lines, no video is saved
            VideoEncoderHints hints = cameraInstance.capture.GetEncoderHints().videoHints;
            // Android only
            hints.androidNoCaptureRotation = true;
            */
            cameraRenderImage.texture = cameraInstance.texture;
            ...

after saving the MP4 video is rotated. How to fix this?

Greetings Frank

MorrisRH commented 1 year ago

Linking #234, #235

Chris-RH commented 1 year ago

Try the workarounds in those links