我正在尝试接收RTSP流并将其转换为HLS sTream。
如果我使用的是ffmpeg版本N-76684-g1fe82ab 这个命令工作正常。
c:\temp\ffmpeg.exe -i "rtsp://192.168.249.233:8554/Stream" -c:v copy -hls_time 3 -hls_wrap 10 "c:\inetpub\wwwroot\hls\streaming.m3u8"
但是,如果我使用较新的编译版本的FFMPEG ffmpeg版本N-83779-gfe57bf7cd6 使用与上面相同的命令我得到错误:
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument.
我做错了什么?我想使用较新的FFMPEG,但似乎它们之间存在某些问题......
完成N-83779的控制台输出
C:\inetpub\wwwroot\hls>ffmpeg.exe -i "rtsp://192.168.249.233:8554/Stream" -c:v copy -hls_time 3 -hls_wrap 10 "c:\inetpub\wwwroot\hls\streaming.m3u8"
ffmpeg version N-83779-gfe57bf7cd6 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.9.3 (GCC)
configuration: --prefix=/usr/local/x86_64-w64-mingw32 --enable-gpl --enable-nonfree --enable-libx264 --enable-libfdk_aac --enable-static --enable-runtime-cpudetect --enable-w32th
reads --disable-shared --disable-ffplay --disable-ffserver --arch=x86_64 --extra-cflags=-I/local/x86_64-w64-mingw32/include --extra-ldflags='-L/local/x86_64-w64-mingw32/lib -static
'
libavutil 55. 48.100 / 55. 48.100
libavcodec 57. 82.102 / 57. 82.102
libavformat 57. 66.103 / 57. 66.103
libavdevice 57. 3.100 / 57. 3.100
libavfilter 6. 74.100 / 6. 74.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
[udp @ 023e9d40] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 039af180] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
Invalid UE golomb code
[h264 @ 023eaca0] log2_max_frame_num_minus4 out of range (0-12): -1094995529
[rtsp @ 023e7220] Failed to open codec in avformat_find_stream_info
Invalid UE golomb code
[NULL @ 023eaca0] log2_max_frame_num_minus4 out of range (0-12): -1094995529
[NULL @ 023eaca0] non-existing PPS 0 referenced
Invalid UE golomb code
[h264 @ 023eaca0] log2_max_frame_num_minus4 out of range (0-12): -1094995529
[NULL @ 023eaca0] non-existing PPS 0 referenced
Last message repeated 20 times
[rtsp @ 023e7220] Stream #0: not enough frames to estimate rate; consider increasing probesize
[rtsp @ 023e7220] Could not find codec parameters for stream 0 (Video: h264 (High), none(progressive)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtsp, from 'rtsp://192.168.249.233:8554/Stream':
Metadata:
title : Session streamed by Stream
comment : Stream
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), none(progressive), 90k tbr, 90k tbn, 180k tbc
[hls @ 039d5140] dimensions not set
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Last message repeated 1 times
尝试 - 分析10M -probesize 10M没有帮助。
ffmpeg -analyzeduration 10M -probesize 10M -i "rtsp://192.168.249.233:8554/Stream" -c:v copy -hls_time 3 -hls_wrap 10 "c:\inetpub\wwwroot\hls\streaming.m3u8"
ffmpeg version N-83779-gfe57bf7cd6 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.9.3 (GCC)
configuration: --prefix=/usr/local/x86_64-w64-mingw32 --enable-gpl --enable-nonfree --enable-libx264 --enable-libfdk_aac --enable-static --enable-runtime-cpudetect --enable-w32threads --disable-shared --disable-ffplay --disable-ffserver --arch=x86_64 --extra-cflags=-I/local/x86_64-w64-mingw32/include --extra-ldflags='-L/local/x86_64-w64-mingw32/lib -static'
libavutil 55. 48.100 / 55. 48.100
libavcodec 57. 82.102 / 57. 82.102
libavformat 57. 66.103 / 57. 66.103
libavdevice 57. 3.100 / 57. 3.100
libavfilter 6. 74.100 / 6. 74.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
[udp @ 0238a140] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 0421f1a0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
Invalid UE golomb code
[h264 @ 0238af20] log2_max_frame_num_minus4 out of range (0-12): -1094995529
[rtsp @ 02387960] Failed to open codec in avformat_find_stream_info
Invalid UE golomb code
[NULL @ 0238af20] log2_max_frame_num_minus4 out of range (0-12): -1094995529
[NULL @ 0238af20] non-existing PPS 0 referenced
Invalid UE golomb code
[h264 @ 0238af20] log2_max_frame_num_minus4 out of range (0-12): -1094995529
[NULL @ 0238af20] non-existing PPS 0 referenced
Last message repeated 24 times
[rtsp @ 02387960] Stream #0: not enough frames to estimate rate; consider increasing probesize
[rtsp @ 02387960] Could not find codec parameters for stream 0 (Video: h264 (High), none(progressive)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtsp, from 'rtsp://192.168.249.233:8554/FirstVuHD':
Metadata:
title : Session streamed by Stream
comment : Stream
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (High), none(progressive), 90k tbr, 90k tbn, 180k tbc
[hls @ 04edf8a0] dimensions not set
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Last message repeated 1 times
使用旧版FFMPEG输出
c:/temp/ffmpeg -i "rtsp://192.168.249.233:8554/Stream" -c:v copy -hls_time 3 -hls_wrap 10 "c:\inetpub\wwwroot\hls\streaming.m3u8"
ffmpeg version N-76684-g1fe82ab Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 6.100 / 55. 6.100
libavcodec 57. 15.100 / 57. 15.100
libavformat 57. 14.100 / 57. 14.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 15.100 / 6. 15.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
[h264 @ 0000000000506d20] log2_max_frame_num_minus4 out of range (0-12): -1
Last message repeated 5 times
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[rtsp @ 0000000000503e60] max delay reached. need to consume packet
[h264 @ 0000000000506d20] RTP: missed 75 packets
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[rtsp @ 0000000000503e60] max delay reached. need to consume packet
[h264 @ 0000000000506d20] RTP: missed 86 packets
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[rtsp @ 0000000000503e60] max delay reached. need to consume packet
[h264 @ 0000000000506d20] RTP: missed 57 packets
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[rtsp @ 0000000000503e60] max delay reached. need to consume packet
[h264 @ 0000000000506d20] RTP: missed 6 packets
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[h264 @ 0000000000506d20] non-existing PPS 0 referenced
Last message repeated 1 times
[h264 @ 0000000000506d20] decode_slice_header error
[h264 @ 0000000000506d20] no frame!
[rtsp @ 0000000000503e60] max delay reached. need to consume packet
[h264 @ 0000000000506d20] RTP: missed 1093 packets
[rtsp @ 0000000000503e60] max delay reached. need to consume packet
[h264 @ 0000000000506d20] RTP: missed 10 packets
[rtsp @ 0000000000503e60] max delay reached. need to consume packet
[h264 @ 0000000000506d20] RTP: missed 2 packets
[rtsp @ 0000000000503e60] max delay reached. need to consume packet
[h264 @ 0000000000506d20] RTP: missed 20 packets
Input #0, rtsp, from 'rtsp://192.168.249.233:8554/Stream':
Metadata:
title : Session streamed by Stream
comment : Stream
Duration: N/A, start: 0.033367, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 1920x1080, 29.97 tbr, 90k tbn, 180k tbc
Output #0, hls, to 'c:\inetpub\wwwroot\hls\streaming.m3u8':
Metadata:
title : Session streamed by Stream
comment : Stream
encoder : Lavf57.14.100
Stream #0:0: Video: h264, yuv420p, 1920x1080, q=2-31, 29.97 tbr, 90k tbn, 90k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[rtsp @ 0000000000503e60] max delay reached. need to consume packet
[NULL @ 0000000000506d20] RTP: missed 211 packets
frame= 398 fps= 71 q=-1.0 size=N/A time=00:00:16.68 bitrate=N/A
答案 0 :(得分:2)
超出范围值是错误代码。
您可以按如下方式解码您的错误代码。来自ffmpeg的错误代码(来自avutil的error.h): http://ffmpeg.org/doxygen/trunk/error_8h_source.html
事实证明你指定的值是:
#define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A')
-1094995529变为-0x41444E49,当您查看这些字母时,在ACSII中,0x41 ='A',0x44 ='D',0x4E ='N,以及0x49 ='I'。由于宏/等事情是相反的,因此ADNI变为INDA,您可以从#define片段中看到,是AVERROR_INVALIDDATA定义的FFERRTAG('I','N','D','A')。
其余的错误代码都在该文件中,我在下面粘贴了它们:
#define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found
#define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2
#define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small
#define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found
#define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found
#define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found
#define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file
#define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted
#define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library
#define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found
#define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input
#define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found
#define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found
#define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome
#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found
#define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found
#define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ')
#define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library
#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
#define AVERROR_INPUT_CHANGED (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED)
#define AVERROR_OUTPUT_CHANGED (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED)
#define AVERROR_HTTP_BAD_REQUEST FFERRTAG(0xF8,'4','0','0')
#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1')
#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3')
#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4')
#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X')
#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X')