如果在 -i 选项中指定文件,ffmpeg会成功处理文件:http://pastebin.com/cn4w4aR2
但是,如果通过pipe(发送到stdin)将文件发送到ffmpeg,我会收到错误流1,偏移量0x24:部分文件:
serafim@serafim:~/Downloads/mov $ cat RecordedVideo-6sec.MOV | ffmpeg -i pipe:0 -codec copy -bsf h264_mp4toannexb -f hls -hls_list_size 0 -hls_time 5 -y index.m3u8
ffmpeg version 2.3.3 Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 25 2014 19:47:15 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.3.3 --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
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
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc6a4816800] stream 1, offset 0x24: partial file
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc6a4816800] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), 720x1280, 1068 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2014-10-12 10:51:18
Duration: 00:00:04.06, bitrate: N/A
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), 720x1280, 1068 kb/s, 24.61 fps, 120 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2014-10-12 10:51:18
handler_name : Core Media Data Handler
encoder : H.264
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 64 kb/s (default)
Metadata:
creation_time : 2014-10-12 10:51:18
handler_name : Core Media Data Handler
[mpegts @ 0x7fc6a481b800] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
Last message repeated 1 times
[adts @ 0x7fc6a481e200] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
Output #0, hls, to 'index.m3u8':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
encoder : Lavf55.48.100
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), 720x1280, q=2-31, 1068 kb/s, 24.61 fps, 600 tbn, 600 tbc (default)
Metadata:
creation_time : 2014-10-12 10:51:18
handler_name : Core Media Data Handler
encoder : H.264
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, 64 kb/s (default)
Metadata:
creation_time : 2014-10-12 10:51:18
handler_name : Core Media Data Handler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fc6a4816800] stream 1, offset 0x28: partial file
pipe:0: Invalid data found when processing input
frame= 0 fps=0.0 q=-1.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
如何通过管道将.mov文件发送到ffmpeg?
答案 0 :(得分:4)
最有可能的问题:QuickTime预先没有moov
原子。有时,术语“快速启动”用于描述QuickTime文件,其文件头部的moov
原子而不是尾部。 QuickTime解复用器需要能够先读取此原子才能解释文件其余部分(mdat
原子)中的数据。
如果输入数据来自文件,文件系统可以随机搜索文件以找到必要的数据。但是,在通过stdin管道时,没有允许这样的(向后)搜索。
解决方案是使用FFmpeg附带的qt-faststart
实用程序重新排列QuickTime文件,或重新考虑您的解决方案,使其不依赖于不可搜索的管道。