error generating videos with ffmeg-cvs and workaround
Posted: Tue Mar 01, 2005 9:00 pm
First, congrat and thankyou for this killer app.
I'm running debian unstable/experimental.
I've upgraded zoneminder from 1.19.4 and ffmpeg with the cvs version of debian (Version: cvs2:20050222-0.0).
All is working great, the streaming (mpeg, and jpg), mov. detection and web browsing.
Only I get an error when i make a video from the recordings, ffmpeg protests with invalid colormap.
here's the proof:
era:/server/vigilancia/events/7/28998$ ffmpeg -i %03d-capture.jpg test.mpg
ffmpeg version cvs, build 4743, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --prefix=/usr --enable-shared --enable-mp3lame --host=i386-linux --enable-gpl --build=i386-linux --mandir=${prefix}/share/man --enable-vorbis --enable-faadbin --enable-faad --enable-a52bin --enable-pthreads --enable-faac --enable-xvid --enable-dts cc --enable-amr_nb --enable-amr_wb
built on Feb 23 2005 14:23:46, gcc: 3.3.5 (Debian 1:3.3.5-8)
Input #0, image2, from '%03d-capture.jpg':
Duration: 00:00:00.8, start: 0.000000, bitrate: N/A
Stream #0.0: Video: mjpeg, 320x240, 25.00 fps
Output #0, mpeg, to 'test.mpg':
Stream #0.0: Video: mpeg1video, 320x240, 25.00 fps, q=2-31, 200 kb/s
Stream mapping:
Stream #0.0 -> #0.0
[mpeg1video @ 0x4033a048]colorspace not supported
Error while opening codec for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
Then I surfed ffmpeg's code and here's the ugly line in ffmpeg/libavcodec/mpegvideo.c :
if(avctx->codec_id == CODEC_ID_MJPEG || avctx->codec_id == CODEC_ID_LJPEG){
if(avctx->strict_std_compliance>=0 && avctx->pix_fmt != PIX_FMT_YUVJ420P){
av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n");
return -1;
}
}else{
avctx->pix_fmt = PIX_FMT_YUV420P;
if(avctx->strict_std_compliance>=0 && avctx->pix_fmt != PIX_FMT_YUV420P){
av_log(avctx, AV_LOG_ERROR, "colorspace not supported\n");
return -1;
}
}
So it seems that the jpg's made by zoneminder don't have the required header pix_fmt = PIX_FMT_YUV420P.
So to workaround this i have to add in the "additional options in ffmpeg" in zoneminder the arg "-strict -1" .
Now it works great.
Greets
Eugenio Sobrino
I'm running debian unstable/experimental.
I've upgraded zoneminder from 1.19.4 and ffmpeg with the cvs version of debian (Version: cvs2:20050222-0.0).
All is working great, the streaming (mpeg, and jpg), mov. detection and web browsing.
Only I get an error when i make a video from the recordings, ffmpeg protests with invalid colormap.
here's the proof:
era:/server/vigilancia/events/7/28998$ ffmpeg -i %03d-capture.jpg test.mpg
ffmpeg version cvs, build 4743, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --prefix=/usr --enable-shared --enable-mp3lame --host=i386-linux --enable-gpl --build=i386-linux --mandir=${prefix}/share/man --enable-vorbis --enable-faadbin --enable-faad --enable-a52bin --enable-pthreads --enable-faac --enable-xvid --enable-dts cc --enable-amr_nb --enable-amr_wb
built on Feb 23 2005 14:23:46, gcc: 3.3.5 (Debian 1:3.3.5-8)
Input #0, image2, from '%03d-capture.jpg':
Duration: 00:00:00.8, start: 0.000000, bitrate: N/A
Stream #0.0: Video: mjpeg, 320x240, 25.00 fps
Output #0, mpeg, to 'test.mpg':
Stream #0.0: Video: mpeg1video, 320x240, 25.00 fps, q=2-31, 200 kb/s
Stream mapping:
Stream #0.0 -> #0.0
[mpeg1video @ 0x4033a048]colorspace not supported
Error while opening codec for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
Then I surfed ffmpeg's code and here's the ugly line in ffmpeg/libavcodec/mpegvideo.c :
if(avctx->codec_id == CODEC_ID_MJPEG || avctx->codec_id == CODEC_ID_LJPEG){
if(avctx->strict_std_compliance>=0 && avctx->pix_fmt != PIX_FMT_YUVJ420P){
av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n");
return -1;
}
}else{
avctx->pix_fmt = PIX_FMT_YUV420P;
if(avctx->strict_std_compliance>=0 && avctx->pix_fmt != PIX_FMT_YUV420P){
av_log(avctx, AV_LOG_ERROR, "colorspace not supported\n");
return -1;
}
}
So it seems that the jpg's made by zoneminder don't have the required header pix_fmt = PIX_FMT_YUV420P.
So to workaround this i have to add in the "additional options in ffmpeg" in zoneminder the arg "-strict -1" .
Now it works great.
Greets
Eugenio Sobrino