ubuntu FFMPEG无法找到带有MP4的编解码器pcm_s16be的标记

jw5wzhpr  于 2022-11-22  发布在  其他
关注(0)|答案(2)|浏览(378)

我正在拼命地尝试用ffmpeg剪切MP4视频,下面是这个[示例] https://github.com/facebookresearch/VideoPose3D/blob/master/INFERENCE.md

ffmpeg -i P1060513copy.mp4 -ss 3:12 -to 3:30 -c copy output.mp4

我收到此错误

ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'P1060513.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42avc1
    creation_time   : 2017-11-15 10:10:14
  Duration: 00:03:52.00, start: 0.000000, bitrate: 51908 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 50365 kb/s, 24 fps, 24 tbr, 360k tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2017-11-15 10:10:14
      timecode        : 01:39:08:00
    Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2017-11-15 10:10:14
      timecode        : 01:39:08:00
    Stream #0:2(und): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2017-11-15 10:10:14
      timecode        : 01:39:08:00
[mp4 @ 0x18bc2c0] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 0x18bc2c0] Codec for stream 1 does not use global headers but container format requires global headers
[mp4 @ 0x18bc2c0] Could not find tag for codec pcm_s16be in stream #1, codec not currently supported in container
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42avc1
    encoder         : Lavf56.40.101
    Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 50365 kb/s, 24 fps, 24 tbr, 360k tbn, 360k tbc (default)
    Metadata:
      creation_time   : 2017-11-15 10:10:14
      timecode        : 01:39:08:00
    Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, stereo, 1536 kb/s (default)
    Metadata:
      creation_time   : 2017-11-15 10:10:14
      timecode        : 01:39:08:00
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

为了避免这个错误,我转换了文件在mkv和削减它(工作完美),然后我想转换回MP4,但结束了同样的错误。
有人能帮我吗?
谢谢你

nkoocmlb

nkoocmlb1#

这似乎是ffmpeg开发人员的已知行为和预期行为。https://trac.ffmpeg.org/ticket/3818
显然,MP4规范不包括pcm_s16be编解码器,因此ffmpeg拒绝创建这样的文件。
这是非常不方便的不幸。当我削减,而只复制视频代码,例如。
00:00:10.440 -到00:00:28.440 -视频编解码器拷贝剪切. MP4
我在音频流中得到了明显的偏移。

9gm1akwq

9gm1akwq2#

保存为mov或将-c copy更改为-c:v copy

# Changing to -c:v copy
$ ffmpeg -i P1060513copy.mp4 -ss 3:12 -to 3:30 -c:v copy output.mp4

# Changing to .mov
$ ffmpeg -i P1060513copy.mp4 -ss 3:12 -to 3:30 -c copy output.mov

相关问题