- 推流的反馈信息
C:\Users\zhouqinan>ffmpeg -i "rtsp://192.168.0.93:554/user=admin&password=&channel=0&stream=1.sdp?real_stream" -c copy -f rtsp -rtsp_transport udp rtsp://192.168.0.41:554/live/stream3
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.1 (GCC) 20200726
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://192.168.0.93:554/user=admin&password=&channel=0&stream=1.sdp?real_stream':
Metadata:
title : RTSP Session
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p(progressive), 704x576, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Output #0, rtsp, to 'rtsp://192.168.0.41:554/live/stream3':
Metadata:
title : RTSP Session
encoder : Lavf58.45.100
Stream #0:0: Video: h264 (Main), yuv420p(progressive), 704x576, q=2-31, 25 fps, 25 tbr, 90k tbn, 25 tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[rtsp @ 0000028b22694180] Non-monotonous DTS in output stream 0:0; previous: 21600, current: 3600; changing to 21601. This may result in incorrect timestamps in the output file.
[rtsp @ 0000028b22694180] Non-monotonous DTS in output stream 0:0; previous: 21601, current: 7200; changing to 21602. This may result in incorrect timestamps in the output file.
[rtsp @ 0000028b22694180] Non-monotonous DTS in output stream 0:0; previous: 21602, current: 10800; changing to 21603. This may result in incorrect timestamps in the output file.
[rtsp @ 0000028b22694180] Non-monotonous DTS in output stream 0:0; previous: 21603, current: 14400; changing to 21604. This may result in incorrect timestamps in the output file.
[rtsp @ 0000028b22694180] Non-monotonous DTS in output stream 0:0; previous: 21604, current: 18000; changing to 21605. This may result in incorrect timestamps in the output file.
[rtsp @ 0000028b22694180] Non-monotonous DTS in output stream 0:0; previous: 21605, current: 21600; changing to 21606. This may result in incorrect timestamps in the output file.
frame= 114 fps= 34 q=-1.0 Lsize=N/A time=00:00:04.56 bitrate=N/A speed=1.38x
video:151kB audio:36kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.
Q:以QByteArray形式接收以上字符串,现在我需要获取frame= 114中的frame帧数
QByteArray qba = p_qprocess_instance->readAllStandardError();
// 即是上面的打印输出
// qDebug() << qba;
uint32_t index_frame = -1;
// 找到目标的索引
index_frame = qba.indexOf("frame=");
uint32_t index_fps = -1;
index_fps = qba.indexOf("fps");
if(12 == (index_fps - index_frame)) {
// 截取感兴趣的字段,并转成int
thread_local static uint16_t frame_num = qba.mid(index_frame+6, 5).toInt();
uint32_t current_frame = qba.mid(6, 5).toInt();
if(frame_num != current_frame)
{
frame_num = current_frame;
flag_is_connected = true;
qDebug() << "frame_num: " << frame_num;
}
}