【问题标题】:ffmpeg4android & MediaRecorder: Forcefully cutting videoffmpeg4android & MediaRecorder:强制剪切视频
【发布时间】:2015-02-04 16:43:27
【问题描述】:

使用 MediaRecorder 从 SurfaceView 录制视频

录音机

recorderProfile = CamcorderProfile.get( CamcorderProfile.QUALITY_480P );
recorder = new MediaRecorder();
recorder.setCamera( camera );
recorder.setAudioSource( MediaRecorder.AudioSource.DEFAULT );
recorder.setVideoSource( MediaRecorder.VideoSource.DEFAULT );
recorder.setOutputFormat( recorderProfile.fileFormat );
recorder.setAudioEncoder( recorderProfile.audioCodec );
recorder.setVideoEncoder( recorderProfile.videoCodec );
recorder.setOutputFile( tempFile.getPath() );
recorder.setOrientationHint( 270 );
recorder.setVideoFrameRate( recorderProfile.videoFrameRate );
recorder.setVideoEncodingBitRate( recorderProfile.videoBitRate );
recorder.setAudioEncodingBitRate( recorderProfile.audioBitRate );
recorder.setAudioChannels( recorderProfile.audioChannels );
recorder.setAudioSamplingRate( recorderProfile.audioSampleRate );
recorder.setVideoSize( size.width, size.height );

命令

“ffmpeg”
“-y”
“-i”
文件
“-严格”、“实验”
“-vf”、“[输入] 裁剪=480:640 [输出]”、
“-s”、“640x480”、
文件

视频大小为 480x640,因为它在裁剪前已旋转

它将视频剪辑到 500 毫秒的长度。

为什么?

【问题讨论】:

  • 桌面版也能做到这一点吗?
  • 我没试过桌面。我无法在桌面上执行此操作。

标签: video ffmpeg android-mediarecorder


【解决方案1】:

recorderProfile.videoCodec: vp8 为我结束了,但 vp9 没有。

请记住,我正在 Chrome Android 上使用网络 MediaRecorder()。

它也与音频相关联,使用视频流录制音轨不会在移动或桌面上使用 vp8 修剪结尾。

桌面上的 vp8 不会发生这种情况。

【讨论】:

    猜你喜欢
    • 2021-12-20
    • 2013-04-08
    • 2023-04-10
    • 2021-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多