I have two video streams from which I'd like to take one frame of each, both of them are RTSP. I'm using the same FFMPEG instruction for both of them but changing the URL of the stream, the first one works but the second one throws the error:
我有两个视频流我想从中取一帧,它们都是RTSP。我对这两个都使用了相同的FFMPEG指令但是改变了流的URL,第一个行得通,但第二个会抛出错误:
method SETUP failed: 455 Method Not Valid In This State
方法设置失败:455方法在此状态无效
Can anyone tell me what could be the reason for this error and how to solve it?
谁能告诉我这个错误的原因是什么以及如何解决它吗?
WORKING
工作
ffmpeg -ss 1 -i rtsp://streamreader:trudat55@69.84.126.216:88/videoMain -an -vcodec mjpeg -vframes 1 -aspect 16:9 -q:v 2 -y test.jpg
ffmpeg version 2.8.2 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --enable-gpl --enable-avresample --enable-libopencore-amrnb --enable-libx264 --enable-libxvid --enable-postproc --enable-version3 --enable-shared --enable-pic --extra-ldexeflags=-pie
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[rtsp @ 0x55a60a0a7420] UDP timeout, retrying with TCP
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://streamreader:trudat55@69.84.126.216:88/videoMain':
Metadata:
title : IP Camera Video
comment : videoMain
Duration: N/A, start: 0.200044, bitrate: N/A
Stream #0:0: Video: h264 (Baseline), yuv420p, 640x480, 50 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s
[swscaler @ 0x55a60a102460] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'test.jpg':
Metadata:
title : IP Camera Video
comment : videoMain
encoder : Lavf56.40.101
Stream #0:0: Video: mjpeg, yuvj420p(pc), 640x480 [SAR 4:3 DAR 16:9], q=2-31, 200 kb/s, 50 fps, 50 tbn, 50 tbc
Metadata:
encoder : Lavc56.60.100 mjpeg
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
frame= 1 fps=0.5 q=2.0 Lsize=N/A time=00:00:00.02 bitrate=N/A dup=1 drop=1
video:66kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
NOT WORKING
不工作
ffmpeg -ss 1 -i rtsp://camaras.corredorautomotriz.cl:554/live.sdp -an -vcodec mjpeg -vframes 1 -aspect 16:9 -q:v 2 -y test.jpg
ffmpeg version 2.8.2 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --enable-gpl --enable-avresample --enable-libopencore-amrnb --enable-libx264 --enable-libxvid --enable-postproc --enable-version3 --enable-shared --enable-pic --extra-ldexeflags=-pie
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[rtsp @ 0x55b98f2de420] UDP timeout, retrying with TCP
[rtsp @ 0x55b98f2de420] method SETUP failed: 455 Method Not Valid In This State
[rtsp @ 0x55b98f2de420] Could not find codec parameters for stream 0 (Video: mjpeg, none(bt470bg/unknown/unknown)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtsp, from 'rtsp://camaras.corredorautomotriz.cl:554/live.sdp':
Metadata:
title : RTSP server
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, none(bt470bg/unknown/unknown), 90k tbr, 90k tbn, 90k tbc
Stream #0:1: Data: none
Output #0, image2, to 'test.jpg':
Output file #0 does not contain any stream
2 个解决方案
#1
1
As I see in your output, ffmpeg
failed to determine input stream type in the second case (rtsp://camaras.corredorautomotriz.cl:554/live.sdp).
正如我在您的输出中看到的,ffmpeg未能确定第二种情况下的输入流类型(rtsp:/ camaras. corredorautomotive .cl:554/live.sdp)。
I checked it, and it got me mpeg4:
我检查了一下,它给了我mpeg4:
Input #0, rtsp, from 'rtsp://camaras.corredorautomotriz.cl:554/live.sdp':
输入#0,rtsp,从'rtsp://camaras. corredorautomotive .cl:554/live.sdp':
Metadata:
元数据:
title : RTSP server
标题:RTSP服务器
Duration: N/A, start: 0.000000, bitrate: N/A
持续时间:N/A,起始时间:0.000000,比特率:N/A
Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 720x480 [SAR 1:1 DAR 3:2], 30 tbr, 30k tbn
视频:mpeg4(简单轮廓),yuv420p, 720x480 [SAR 1:1 DAR 3:2], 30 tbr, 30k tbn
Thus possibly you compiled ffmpeg without mpeg4 decoder (or with broken decoder).
因此,您可能编译了没有mpeg4解码器的ffmpeg(或使用损坏的解码器)。
#2
0
I found that if I specify that the protocol is TCP with the instruction -rtsp_transport tcp
then i don't get an error:
我发现如果我指定协议是TCP,指令是-rtsp_transport TCP,那么我不会得到错误:
ffmpeg -ss 5 -rtsp_transport tcp -i rtsp://camaras.corredorautomotriz.cl:554/live.sdp -s 640x480 -aspect 16:9 -b:v 800k -r 24 video.flv
ffmpeg - ss5 -rtsp_transport tcp -i rtsp://camaras. corredorautomotive .cl:554/live。sdp -s 640x480 -aspect 16:9 -b:v 800k -r 24可视电话
But I would still like to know the reason and solution of the problem I got before, because I am not sure I can use this parameter. Anyone knows?
但是我仍然想知道我之前的问题的原因和解决方法,因为我不确定我是否可以使用这个参数。有人知道吗?
Thanks
谢谢
#1
1
As I see in your output, ffmpeg
failed to determine input stream type in the second case (rtsp://camaras.corredorautomotriz.cl:554/live.sdp).
正如我在您的输出中看到的,ffmpeg未能确定第二种情况下的输入流类型(rtsp:/ camaras. corredorautomotive .cl:554/live.sdp)。
I checked it, and it got me mpeg4:
我检查了一下,它给了我mpeg4:
Input #0, rtsp, from 'rtsp://camaras.corredorautomotriz.cl:554/live.sdp':
输入#0,rtsp,从'rtsp://camaras. corredorautomotive .cl:554/live.sdp':
Metadata:
元数据:
title : RTSP server
标题:RTSP服务器
Duration: N/A, start: 0.000000, bitrate: N/A
持续时间:N/A,起始时间:0.000000,比特率:N/A
Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 720x480 [SAR 1:1 DAR 3:2], 30 tbr, 30k tbn
视频:mpeg4(简单轮廓),yuv420p, 720x480 [SAR 1:1 DAR 3:2], 30 tbr, 30k tbn
Thus possibly you compiled ffmpeg without mpeg4 decoder (or with broken decoder).
因此,您可能编译了没有mpeg4解码器的ffmpeg(或使用损坏的解码器)。
#2
0
I found that if I specify that the protocol is TCP with the instruction -rtsp_transport tcp
then i don't get an error:
我发现如果我指定协议是TCP,指令是-rtsp_transport TCP,那么我不会得到错误:
ffmpeg -ss 5 -rtsp_transport tcp -i rtsp://camaras.corredorautomotriz.cl:554/live.sdp -s 640x480 -aspect 16:9 -b:v 800k -r 24 video.flv
ffmpeg - ss5 -rtsp_transport tcp -i rtsp://camaras. corredorautomotive .cl:554/live。sdp -s 640x480 -aspect 16:9 -b:v 800k -r 24可视电话
But I would still like to know the reason and solution of the problem I got before, because I am not sure I can use this parameter. Anyone knows?
但是我仍然想知道我之前的问题的原因和解决方法,因为我不确定我是否可以使用这个参数。有人知道吗?
Thanks
谢谢