为什么ffmpeg -rtsp_transport tcp -i无法使用service_provider复制rtsp流:Harmonic?

问题描述 投票:-1回答:1

我正在尝试通过linux命令行将rtsp stream复制到ts文件。输入流信息:

Input #0, rtsp, from 'rtsp://***.***.***.***:554/****/****/****.smil':
  Metadata:
    title           : live
  Duration: N/A, start: 21023.919478, bitrate: 18438 kb/s
  Program 1 
    Metadata:
      service_name    : *****
      service_provider: Harmonic
    Stream #0:0: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 17990 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1(eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 448 kb/s
Output #0, mpegts, to '123.ts':
  Metadata:
    title           : live
    encoder         : Lavf56.40.101
    Stream #0:0: Video: mpeg2video ([2][0][0][0] / 0x0002), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 17990 kb/s, 25 fps, 25 tbr, 90k tbn, 90k tbc
    Stream #0:1(eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, 448 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)

但它返回错误信息:

[mpegts @ 0x177daa0] first pts value must be set
av_interleaved_write_frame(): Invalid data found when processing input
frame=   11 fps=0.0 q=-1.0 Lsize=     876kB time=00:00:00.79 bitrate=9055.7kbits/s    
video:974kB audio:24kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

然后退出。

我的命令在另一个rtsp流中工作:

Input #0, rtsp, from 'rtsp://***.***.***.***:554/****/****/****.smil':
  Metadata:
    title           : live
  Duration: N/A, start: 29796.561522, bitrate: N/A
  Program 1 
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
    Stream #0:1(eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s

我的下载命令是:

ffmpeg -rtsp_transport tcp -i "rtsp://***.***.***.***:554/****/****/****.smil" -c copy "`TZ=UTC+8 date "+%Y-%m-%d.%H-%M-%S"`.ts"
linux shell ffmpeg rtsp
1个回答
0
投票

我自己解决这个问题:只需将.ts修改为.avi即可

ffmpeg -rtsp_transport tcp -i "rtsp://***.***.***.***:554/****/****/****.smil" -c copy "`TZ=UTC+8 date "+%Y-%m-%d.%H-%M-%S"`.avi"
© www.soinside.com 2019 - 2024. All rights reserved.