在iPhone上的颤振相机插件景观视频

问题描述 投票:0回答:2

在横向上的iPhone X上运行Camera Plugin示例应用程序时,视频无法以正确的方向捕获。它在Portrait中运行良好。

enter image description here

pubspec.yaml

版本:1.0.0 + 1

环境:sdk:“> = 2.0.0-dev.68.0 <3.0.0”

依赖:flutter:sdk:flutter

cupertino_icons:^ 0.1.2

相机:^ 0.4.2

path_provider:^ 0.5.0

video_player:^ 0.10.0

firebase_core:^ 0.2.5

扑医生

[✓] Flutter(频道未知,v1.1.0,在Mac OS X 10.14.3 18D109上,locale en-AU)

[✓] Android工具链 - 针对Android设备开发(Android SDK 28.0.3)

[✓] iOS工具链 - 为iOS设备开发(Xcode 10.1)

[✓] Android Studio(3.2版)

[✓]连接设备(1个可用)

flutter video-capture
2个回答
0
投票

@Dave,尝试使用以下小部件在横向中设置预览:


  Widget widTakePhoto2(context) {

       if (!ctlCamera.value.isInitialized) {

          return Container();

        }



    return Stack(

      children: <Widget>[

        RotatedBox(

          quarterTurns: 3,

          child: AspectRatio(

            aspectRatio: ctlCamera.value.aspectRatio,

            child: CameraPreview(ctlCamera),

          ),

        ),

        Center(child: Text(

            (gv.intHomeCameraCountDown > 0) ? gv.intHomeCameraCountDown.toString() : '',

            style: TextStyle(fontSize: sv.dblDefaultFontSize * 3, color: Colors.red, fontWeight: FontWeight.bold)))

      ],

    );

  }

即将小部件aspectratio放在一个rotatebox小部件中,这个小部件widtakephoto2应该是你的脚手架小部件的“主体”。并且忘记了堆栈小部件,我在使用堆栈在拍摄照片或视频之前显示3,2,1。


0
投票

直到官方包中的支持土地,我已经成功与flutter_ffmpeg设置适当的元数据。


const int AV_LOG_ERROR = 16;

final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();
_flutterFFmpeg.setLogLevel(AV_LOG_ERROR);

/// The :s:v:0 after -metadata is the stream specifier,
/// which just tells ffmpeg to which stream it should add the metadata.
/// :s stands for the streams of the input file,
/// :v selects video streams and the number is the stream index,
/// zero-based - so this will select the first video stream.
/// The -c option specifies the codec
/// to be used, with copy for just copying the streams, without re-encoding.
final String looselessConversion = '-i $videoPath.mp4 -c copy -metadata:s:v:0 rotate=90 $videoPath-processed.mp4';

try {
  final int returnCode = await _flutterFFmpeg.execute(looselessConversion);

  if(returnCode == 0) {
    // delete the origina video file
    await File('$videoPath.mp4').delete();
  } else {
    throw _flutterFFmpeg.getLastCommandOutput();
  }
} catch (e) {
  print('video processing error: $e);
}

因为我没有对视频进行编码(只是编辑元数据),所以对于任何长度的视频文件,该过程在不到10ms的时间内完成。

© www.soinside.com 2019 - 2024. All rights reserved.