0

我有一个提供 RTSP 流的网络摄像头,我想将它保存到 MOV 块中,比如说 5 秒。流是:

rtsp://user:pwd@192.168.1.90:10554/tcp/av0_0

我可以打开流并在 VLC 中播放。我运行 ffmpeg 如下,看起来很正常,但输出仅为黑色视频。我哪里做错了?

ffmpeg -rtsp_transport tcp -i "rtsp://user:pwd@192.168.1.90:10554/tcp/av0_0" -f segment -segment_time 5 -segment_format mov -c copy -map 0 video%d.mov
ffmpeg version 3.1.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.31)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-ffplay --disable-lzma --enable-vda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://user:pwd@192.168.1.90:10554/tcp/av0_0':
  Metadata:
    title           : streamed by the RTSP server
  Duration: N/A, start: 0.230000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p, 1280x720, 20 fps, 25 tbr, 90k tbn, 40 tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s
[segment @ 0x7fda5e012400] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, segment, to 'video%d.mov':
  Metadata:
    title           : streamed by the RTSP server
    encoder         : Lavf57.41.100
    Stream #0:0: Video: h264, yuv420p, 1280x720, q=2-31, 20 fps, 25 tbr, 10240 tbn, 40 tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[segment @ 0x7fda5e012400] Non-monotonous DTS in output stream 0:0; previous: 0, current: -1946; changing to 1. This may result in incorrect timestamps in the output file.
[segment @ 0x7fda5e012400] Non-monotonous DTS in output stream 0:0; previous: 1, current: -1536; changing to 2. This may result in incorrect timestamps in the output file.
[segment @ 0x7fda5e012400] Non-monotonous DTS in output stream 0:0; previous: 2, current: -1126; changing to 3. This may result in incorrect timestamps in the output file.
[segment @ 0x7fda5e012400] Non-monotonous DTS in output stream 0:0; previous: 3, current: -717; changing to 4. This may result in incorrect timestamps in the output file.
[segment @ 0x7fda5e012400] Non-monotonous DTS in output stream 0:0; previous: 4, current: -307; changing to 5. This may result in incorrect timestamps in the output file.
frame=  204 fps= 24 q=-1.0 Lsize=N/A time=00:00:07.89 bitrate=N/A speed=0.937x
video:2057kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.
4

0 回答 0