error generating videos with ffmeg-cvs and workaround

Support and queries relating to all previous versions of ZoneMinder
Locked
eid0
Posts: 1
Joined: Tue Mar 01, 2005 8:30 pm

error generating videos with ffmeg-cvs and workaround

Post by eid0 »

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
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for the tip!

Phil
User avatar
voronwe
Posts: 193
Joined: Tue Jan 18, 2005 12:40 am
Location: Copenhagen Denmark

Post by voronwe »

Hi Guys

Having tested this problem abit i found that on my config with the latest cvs release from ffmpeg and the " -strict -1" in Zoneminder. On my 1st run of generating video i get a video of 0.00 seconds, after removeing the -strict -1 and saving the options again i can make a video from the same event witch last 30 sec. if i then restart zoneminder i cant make video again.

System. :
Zoneminder V 1.20.1
Linux : Fedora Core 3
FFmpeg : 0.4.9-pre1 build 4744

Client :
wmp : 9.0
Win 2K
IE 6.0.2800

If u want me to post zmvideo.log i can do that.

Update. :

Hmm it turns out that it actually made the video stream the 1st time, just that it dident stream it to my wmp therefor resulting in an 0.0 sec video, if i ask it to remake the video and not overwrite the Existing then it streams the full video, and all this with the "-strict -1" active. If i then activate the overwrite the Existing then it only gives me the 0.0 sec version.

Cheers
Tom
Best Regards
Tom Stage
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hello.

Could you please check the montage feature (create a second monitor if you have only one camera), and see whether it streams succesfully all of the cameras?

Thank you.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Locked