ffmpeg无法从iPhone 4转换mov文件

时间:2014-09-13 20:34:47

标签: ios4 ffmpeg mov

我遇到从iPhone 4转换mov文件的问题。

运行此命令:

I, [2014-09-15T03:48:33.245231 #9676]  INFO -- : Running transcoding...
ffmpeg -y -i /Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video/1410727644xqxzdoxf-IMG_0040_1_.MOV -ss 5 -vframes 1 -f image2 /Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video/1410727644xqxzdoxf-IMG_0040_1_-edited.jpg

E, [2014-09-15T03:48:33.321367 #9676] ERROR -- : Failed encoding...
ffmpeg -y -i /Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video  /1410727644xqxzdoxf-IMG_0040_1_.MOV -ss 5 -vframes 1 -f image2 /Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video/1410727644xqxzdoxf-IMG_0040_1_-edited.jpg

我的ffmpeg给了我这样的错误:

FFMPEG::Error: Failed encoding.Errors: no output file created. Full output: ffmpeg version 2.3.1 Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 20 2014 02:23:29 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.3.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libtheora --enable-libvorbis --enable-libvpx
libavutil      52. 92.100 / 52. 92.100
libavcodec     55. 69.100 / 55. 69.100
libavformat    55. 48.100 / 55. 48.100
libavdevice    55. 13.102 / 55. 13.102
libavfilter     4. 11.100 /  4. 11.100
libavresample   1.  3.  0 /  1.  3.  0
libswscale      2.  6.100 /  2.  6.100
libswresample   0. 19.100 /  0. 19.100
libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video/1410641311nyv99k1j-IMG_0040_1_.MOV':
Metadata:
  major_brand     : qt
  minor_version   : 0
  compatible_brands: qt
creation_time   : 2014-07-20 09:47:08
model           : iPhone 4
model-rus       : iPhone 4
encoder         : 7.0.4
encoder-rus     : 7.0.4
date            : 2014-07-20T13:47:08+0400
date-rus        : 2014-07-20T13:47:08+0400
make            : Apple
make-rus        : Apple
Duration: 00:00:01.84, start: 0.000000, bitrate: 827 kb/s
  Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 480x360, 742 kb/s, 23.98 fps, 23.98 tbr, 600 tbn, 1200 tbc (default)
Metadata:
  rotate          : 90
  creation_time   : 2014-07-20 09:47:08
  handler_name    : Core Media Data Handler
  encoder         : H.264
Side data:
  displaymatrix: rotation of -90.00 degrees
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s (default)
Metadata:
  creation_time   : 2014-07-20 09:47:08
  handler_name    : Core Media Data Handler
[swscaler @ 0x7fe1e9800600] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to '/Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video/1410641311nyv99k1j-IMG_0040_1_-edited.jpg':
Metadata:
major_brand     : qt
minor_version   : 0
compatible_brands: qt
make-rus        : Apple
model           : iPhone 4
model-rus       : iPhone 4
make            : Apple
encoder         : Lavf55.48.100
date            : 2014-07-20T13:47:08+0400
date-rus        : 2014-07-20T13:47:08+0400
Stream #0:0(und): Video: mjpeg, yuvj420p, 480x360, q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
Metadata:
  rotate          : 90
  creation_time   : 2014-07-20 09:47:08
  handler_name    : Core Media Data Handler
  encoder         : Lavc55.69.100 mjpeg
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

这只发生在mov文件中。有几个棘手的地方,它似乎试图从视频中截取屏幕截图。

也许有人见过类似的东西,可以给我一个提示?

1 个答案:

答案 0 :(得分:1)

问题

您的命令告诉ffmpeg跳过前5秒,但控制台输出表明输入持续时间仅为00:00:01.84(不到2秒)。


使用选择过滤器

如果您尝试从持续时间不同的各种输入中截取屏幕截图,则可以查看select filter而非使用-ss

创建各种场景的马赛克示例:

ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png

ffprobe-ss

一起使用

或者,通过某些脚本,您可以使用ffprobe to get the duration,然后为-ss计算适当的值。