如何在android中调用ffmpeg视频命令

问题描述

我正在尝试使用此命令:

FFmpeg.execute("-f android_camera -i 0:0 -r 30 -pixel_format bgr0 -t 00:00:05 <record file path>");

来自这个库:

https://github.com/tanersener/mobile-ffmpeg

该命令告诉摄像机根据命令中定义的规范开始录制。

作为一个全新的安卓开发者,我有以下问题:

在哪里/如何将此命令添加到我的代码中?我正在关注 android 上的基本教程,该教程向您展示了如何使用文本字段和按钮制作应用程序。我想使用按钮作为触发此视频命令的方式。以下是我在 MainActivity.kt 中的代码

package com.example.camera

import androidx.appcompat.app.AppCompatActivity
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.EditText
import com.arthenica.mobileffmpeg.FFmpeg;



const val EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }

    /** Called when the user taps the Send button */
    fun sendMessage(view: View) {
        val editText = findViewById<EditText>(R.id.editText)
        val message = editText.text.toString()
        val intent = Intent(this,displayMessageActivity::class.java).apply {
            putExtra(EXTRA_MESSAGE,message)
        }
  

        startActivity(intent)
    }
}

这是添加命令的正确文件吗?如果是这样,我如何添加它?现在,我只想在我点击应用上的按钮后开始录制视频。

我试过了:

        val intent = Intent(FFmpeg.execute("-f android_camera -i 0:0 -r 30 -pixel_format bgr0 -t 00:00:05"))

但我收到此错误

e: /Users/AndroidStudioProjects/camera/app/src/main/java/com/example/camera/MainActivity.kt: (27,22): None of the following functions can be called with the arguments supplied: 
public constructor Intent(p0: Intent!) defined in android.content.Intent
public constructor Intent(p0: String!) defined in android.content.Intent

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...