1

我正在尝试使用 ffmpeg 从 mp4 文件创建 1s 剪辑到 mpeg,但出现错误:

ffmpeg -i /tmp/myfile.mp4 -y -ss 00:00:01 -t 00:00:01.000 /tmp/myfilesplit.1.mpg

ffmpeg version N-31716-g318fd9d, Copyright (c) 2000-2011 the FFmpeg developers
  built on Aug  1 2011 16:10:33 with gcc 4.4.5
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-libvpx
  libavutil    51. 11. 1 / 51. 11. 1
  libavcodec   53.  9. 0 / 53.  9. 0
  libavformat  53.  6. 0 / 53.  6. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 27. 5 /  2. 27. 5
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0

Seems stream 0 codec frame rate differs from container frame rate: 18.75 (1706/91) -> 18.75 (75/4)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/myfile.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf52.93.0
  Duration: 00:14:29.70, start: 0.000000, bitrate: 530 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 400 kb/s, 9.38 fps, 18.75 tbr, 853 tbn, 18.75 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
    Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 127 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
[buffer @ 0x19cee60] w:320 h:240 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:
[mpeg1video @ 0x19cf4a0] MPEG1/2 does not support 15/1 fps
Output #0, mpeg, to '/tmp/myfilesplit.1.mpg':
    Stream #0.0(und): Video: mpeg1video, yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 15 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
    Stream #0.1(und): Audio: mp2, 44100 Hz, stereo, s16, 64 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height

我该如何解决这个错误[mpeg1video @ 0x19cf4a0] MPEG1/2 does not support 15/1 fps?以某种方式添加空的 P 帧,还是类似的?我正在尝试使用任何输入来完成此操作,因此我正在寻找一种可以将其编程到我的 php 脚本中的通用方法。

4

1 回答 1

8

你应该使用ntsc-vcd目标。所以你可以使用这样的命令

 ffmpeg  -t 00:00:01 -i /tmp/myfile.mp4 -target ntsc-vcd /tmp/myfilesplit.1.mpg
于 2011-08-07T10:40:12.720 回答