video - 通过管道 (stdin) 将 .mov 文件发送到 ffmpeg

标签 video ffmpeg pipe stdin mov

如果在-i 选项中指定文件,ffmpeg 成功处理文件:http://pastebin.com/cn4w4aR2

但是,如果通过管道(到标准输入)将文件发送到 ffmpeg,我会收到错误 stream 1, offset 0x24: partial file:

    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?

最佳答案

最有可能的问题:QuickTime 前面没有它的 moov 原子。有时,术语“快速启动”用于描述 QuickTime 文件,其 moov 原子位于文件的头部而不是尾部。 QuickTime 多路分解器需要先读取这个原子,然后才能解释文件其余部分(mdat 原子)中的数据。

如果输入数据来自文件,文件系统可以在文件周围随机寻找以定位必要的数据。然而,在通过标准输入的管道中,不允许这样的(向后)查找。

解决方案是使用 FFmpeg 附带的 qt-faststart 实用程序重新排列 QuickTime 文件,或者重新考虑您的解决方案,使其不依赖于不可搜索的管道。

关于video - 通过管道 (stdin) 将 .mov 文件发送到 ffmpeg,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26326144/

相关文章:

javascript - NodeJS 将视频的数组缓冲区提取为图像

ffmpeg - 如何在 sdl 版本 1.2.5 中隐藏 sdl 屏幕?

angular - 使用 Angular 中的 Pipe 过滤器从数组中过滤唯一元素

vim - 在 Vim 中通过管道将缓冲区传输到外部命令

Bash tail 命令和多个管道

python - 模块对象没有属性 'VideoCapture'

无法使用 C 中的简单示例使用 GStreamer 启动视频

video - 丢弃数据包而不是导致 DTS 错误

linux - 如何使用 ssh 或 putty 在 linux 上安装 ffmpeg

ffmpeg 和 2 :35:1 aspect ratio