使用 ffmpeg 剪辑的视频比预期的要短

使用 ffmpeg 剪辑的视频比预期的要短

我正在尝试从 MP4 视频 (大小:1.44 GB,长度:02:23:38) 中获取长度为 6 秒的剪辑。但视频流在 1 秒后停止,而音频流继续正常播放直至 6 秒。

我正在使用这个命令来进行剪辑:

ffmpeg -i myvid.mp4 -ss 00:50:40.0 -c:v copy -c:a copy -t 00:00:06.0 -async 1 clip.mp4

有人能帮助我解决这个问题吗?

谢谢

更新 1: 以下是命令的输出:

ffmpeg version N-69530-g52f2adc-Sherpya Copyright (c) 2000-2015 the FFmpeg devel
opers
  built with gcc 4.9.2 (GCC)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myvid.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-02-22 12:22:10
  Duration: 02:23:38.07, start: 0.000000, bitrate: 1437 kb/s
    Chapter #0:0: start 0.000000, end 354.125000
    Metadata:
      title           : 00:00:00.000
    Chapter #0:1: start 354.125000, end 2339.125000
    Metadata:
      title           : 00:05:54.125
    Chapter #0:2: start 2339.125000, end 2573.125000
    Metadata:
      title           : 00:38:59.125
    Chapter #0:3: start 2573.125000, end 3504.750000
    Metadata:
      title           : 00:42:53.125
    Chapter #0:4: start 3504.750000, end 3854.458000
    Metadata:
      title           : 00:58:24.750
    Chapter #0:5: start 3854.458000, end 4364.125000
    Metadata:
      title           : 01:04:14.458
    Chapter #0:6: start 4364.125000, end 5029.125000
    Metadata:
      title           : 01:12:44.125
    Chapter #0:7: start 5029.125000, end 5526.750000
    Metadata:
      title           : 01:23:49.125
    Chapter #0:8: start 5526.750000, end 5796.958000
    Metadata:
      title           : 01:32:06.750
    Chapter #0:9: start 5796.958000, end 6084.416000
    Metadata:
      title           : 01:36:36.958
    Chapter #0:10: start 6084.416000, end 8316.416000
    Metadata:
      title           : 01:41:24.416
    Chapter #0:11: start 8316.416000, end 8618.068333
    Metadata:
      title           : 02:18:36.416
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x544
[SAR 1:1 DAR 40:17], 1242 kb/s, 24 fps, 24 tbr, 96 tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2013-02-22 12:22:10
      handler_name    : Jab We Met (2009) BRRip 1080P DTS ESub Chapters [DDR]
    Stream #0:1(und): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fl
tp, 192 kb/s (default)
    Metadata:
      creation_time   : 2013-02-22 12:22:23
      handler_name    : på.
Output #0, mp4, to 'clip.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    encoder         : Lavf56.19.100
    Chapter #0:0: start 0.000000, end 6.000000
    Metadata:
      title           : 00:42:53.125
    Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x544 [S
AR 1:1 DAR 40:17], q=2-31, 1242 kb/s, 24 fps, 24 tbr, 12288 tbn, 96 tbc (default
)
    Metadata:
      creation_time   : 2013-02-22 12:22:10
      handler_name    : Jab We Met (2009) BRRip 1080P DTS ESub Chapters [DDR]
    Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, 5.1, 192 kb
/s (default)
    Metadata:
      creation_time   : 2013-02-22 12:22:23
      handler_name    : på.
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=   25 fps=6.4 q=-1.0 Lsize=     226kB time=00:00:06.01 bitrate= 307.1kbits
/s
video:82kB audio:141kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 1.334416%

答案1

当您的目标只是编码流的一部分时,您实际上不应该复制编码流。您可以将-ss&-t选项放在输入文件之前,但剪切将在关键帧上完成,或者将它们放在输出文件之前,就像您为精确剪切所做的那样,但您必须对视频进行转码,即-c:v copy -c:a copy从命令中删除。详细说明可在这个答案

相关内容