这是我的代码使用ffmpeg我想有视频缩略图但我不熟悉ffmpeg可以有人知道我得到的错误.
[swscaler @ 0x7ff8da028c00] deprecated pixel format used, make sure you did set range correctly
Output #0, mjpeg, to 'image.jpg':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf56.36.100
Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 320x240 [SAR 4:3 DAR 16:9], q=2-31, 200 kb/s, 1 fps, 1 tbn, 1 tbc (default)
Metadata:
creation_time : 2016-11-06 09:40:22
handler_name : ISO Media file produced by Google Inc.
encoder : Lavc56.41.100 mjpeg
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg …Run Code Online (Sandbox Code Playgroud) 我正在使用FFMpeg解码RTSP视频流。在显示时间(致电cv::imshow(...)),我收到以下异常:
[swscaler @ 0d55e5c0]使用了不赞成使用的像素格式,请确保您正确设置了范围
我正在将像素格式从“ AV_PIX_FMT_YUVJ420P”转换为“ AV_PIX_FMT_YUV420P”。仍然出现上述异常。任何帮助表示赞赏;
int Decodestream()
{
av_register_all();
avdevice_register_all();
avcodec_register_all();
avformat_network_init();
const char *filenameSrc = "rtsp://192.168.1.67/gnz_media/second";
AVCodecContext *pCodecCtx;
AVFormatContext *pFormatCtx = avformat_alloc_context();
AVCodec * pCodec;
AVFrame *pFrame, *pFrameRGB;
if(avformat_open_input(&pFormatCtx,filenameSrc,NULL,NULL) != 0)
{return -1;}
if(av_find_stream_info(pFormatCtx) < 0)
{return -1;}
av_dump_format(pFormatCtx, 0, filenameSrc, 0);
int videoStream = 1;
for(int i=0; i < pFormatCtx->nb_streams; i++)
{
if(pFormatCtx->streams[i]->codec->coder_type==AVMEDIA_TYPE_VIDEO)
{
videoStream = i;
break;
}
}
if(videoStream == -1) return -1 ;
pCodecCtx = pFormatCtx->streams[videoStream]->codec;
pCodec =avcodec_find_decoder(pCodecCtx->codec_id);
if(pCodec==NULL)
{return -1;} …Run Code Online (Sandbox Code Playgroud)