首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FFmpeg错误:无法为“”找到合适的输出格式

FFmpeg错误:无法为“”找到合适的输出格式
EN

Stack Overflow用户
提问于 2019-01-28 17:49:14
回答 2查看 10.8K关注 0票数 1

我对ffmpeg和Android程序都很陌生。我正在尝试从一个URL加载一个视频,并用ffmpeg对其进行裁剪。我想把视频保存到文件里。这是我在网上找到的命令:

代码语言:javascript
复制
"-i " + videoUrl + "-filter:v crop=240:120:100:100 -c:a copy test.mp4"

我试过了,得到了错误的Unable to find a suitable output format for ''

因此,我试图缩小可能的原因,并尝试了以下命令:

代码语言:javascript
复制
"-i " + videoUrl + " -c:v copy -c:a copy test.mp4"
"-i " + videoUrl + " -c:v copy test.mp4"
"-i " + videoUrl + " -c:a copy test.mp4"
"-i " + videoUrl + " test.mp4"

因此,就我所知,就最后一条评论而言,我基本上把它简化到了最低限度。但同样的结果。

他们都给了我同样的错误。这是我通过FFmpeg.getLatestOutput()获得的全部输出

代码语言:javascript
复制
ffmpeg version v4.2-dev-480 Copyright (c) 2000-2018 the FFmpeg developers
      built with Android (4751641 based on r328903) clang version 7.0.2 (https://android.googlesource.com/toolchain/clang 003100370607242ddd5815e4a043907ea9004281) (https://android.googlesource.com/toolchain/llvm 1d739ffb0366421d383e04ff80ec2ee591315116) (based on LLVM 7.0.2svn)
      configuration: --cross-prefix=i686-linux-android- 
                     --sysroot=/files/android-sdk/ndk-bundle/toolchains/mobile-ffmpeg-api-24-i686/sysroot
                     --prefix=/home/taner/Projects/mobile-ffmpeg/prebuilt/android-x86/ffmpeg 
                     --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=i686 --cpu=i686 
                     --target-os=android --disable-neon --disable-asm --disable-inline-asm 
                     --enable-cross-compile --enable-pic --enable-jni --enable-lto 
                     --enable-optimizations --enable-swscale --enable-shared 
                     --disable-v4l2-m2m --disable-outdev=v4l2 
                     --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev 
                     --enable-small --disable-openssl --disable-xmm-clobber-test 
                     --disable-debug --disable-neon-clobber-test --disable-programs 
                     --disable-postproc --disable-doc --disable-htmlpages 
                     --disable-manpages --disable-podpages --disable-txtpages 
                     --disable-static --disable-sndio --disable-schannel 
                     --disable-securetransport --disable-xlib --disable-cuda 
                     --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau 
                     --disable-videotoolbox --disable-audiotoolbox --disable-appkit 
                     --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc 
                     --disable-vaapi --disable-vdpau --enable-libfontconfig 
                     --enable-libfreetype --enable-libfribidi --enable-gmp --enable-gnutls 
                     --enable-libmp3lame --enable-libass --enable-iconv --enable-libtheora 
                     --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxml2 
                     --enable-libopencore-amrnb --enable-libopencore-amrwb 
                     --enable-libshine --enable-libspeex --enable-libwavpack 
                     --enable-libkvazaar --enable-libilbc --enable-libopus 
                     --enable-libsnappy --enable-libsoxr --enable-libaom --enable-libtwolame 
                     --disable-sdl2 --enable-zlib --enable-mediacodec
      libavutil      56. 25.100 / 56. 25.100
      libavcodec     58. 42.104 / 58. 42.104
      libavformat    58. 25.100 / 58. 25.100
      libavdevice    58.  6.101 / 58.  6.101
      libavfilter     7. 46.101 /  7. 46.101
      libswscale      5.  4.100 /  5.  4.100
      libswresample   3.  4.100 /  3.  4.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://MyVideoUrl.com/example':
      Metadata:
        major_brand     : mp42
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        creation_time   : 2019-01-28T13:44:03.000000Z
        encoder         : HandBrake 1.2.0 2018122200
      Duration: 00:00:14.33, start: 0.000000, bitrate: 4478 kb/s
        Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1520x2700 [SAR 6075:4864 DAR 45:64], 4475 kb/s, 30.07 fps, 30 tbr, 90k tbn, 180k tbc (default)
        Metadata:
          creation_time   : 2019-01-28T13:44:03.000000Z
          handler_name    : VideoHandler
    [NULL @ 0x91833c00] Unable to find a suitable output format for ''
    : Invalid argument
    .

为什么ffmpeg假设我没有给它任何输出格式,以及我需要做什么才能使它工作?

我在用implementation 'com.arthenica:mobile-ffmpeg-full:4.2'

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-01-29 10:03:07

事实证明,错误信息不仅仅是误导。所有其他的android编程初学者。

仅仅因为您从活动中获得了目录路径,并不意味着您有在其中写入的权限。

看起来很明显(而且可能是这样),但仍然如此。如果外部源给出错误的错误消息,这可能会使您感到困惑。我的错误是尝试在我没有权限的文件夹中写入输出文件。

通过以下代码对其进行测试:

代码语言:javascript
复制
File test = new File("existingPath/myTestPath");

if(test.mkdirs())
    Log.e("FILE", "MADE IT!!");
else
    Log.e("FILE", "DIDNT MAKE IT!!");
票数 2
EN

Stack Overflow用户

发布于 2019-07-21 14:28:03

只是想补充一下,在我的例子中,问题是我的命令中有一个额外的空间(在-map前面有两个空格,而不是一个),所以也来看看这个。我会补充评论,但低于50代表,我花了几个小时试图找出为什么它不起作用。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54407583

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档