MPEG Generation cuts short

Support and queries relating to all previous versions of ZoneMinder
Locked
JonThompson
Posts: 22
Joined: Wed Feb 09, 2005 4:25 pm

MPEG Generation cuts short

Post by JonThompson »

Hello once again.

I'm having trouble with MPEG generation. The encoder apparently is only taking the first page (from the frame by frame view) of JPEGs when encoding it into a MPEG file.

Is there a setting I am missing that will allow it to use all of the frames in the MPEG file?
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Are you talking about the static mpeg file generation (rather than the etsreaming)? If so do you see any errors in zmvideo.log? People have reported that newer versions of ffmpeg are rather miserly about what frame rates they allow whereas 0.4.8 seems to be a lot more flexible. You can always use zmvideo.pl directly if you want to investigate this a little more without needing to get involved with the web interface.

Phil
JonThompson
Posts: 22
Joined: Wed Feb 09, 2005 4:25 pm

Post by JonThompson »

I am talking about static. The problem is this...

When I try and create video, it only encodes the first 30 frames or so, then quits, so I get a second of video where I should have 10+
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Video generation is very much in the hands of which version of ffmpeg you have installed. Is there anything odd in zmvideo.log?

If you hit problems like this, the best thing is sometimes to try and manually try and generate a file using ffmpeg and then to edit the ZM options to ensure that the same options are passed in. If you can't do it manualy with a particular set of options then it's unlikely that ZM will be able to do it automatically.

Phil
JonThompson
Posts: 22
Joined: Wed Feb 09, 2005 4:25 pm

Post by JonThompson »

OK, here's the problem...

If I manually use this command...


sudo /usr/local/bin/ffmpeg -y -hq -intra -r 20.89 -s 640x320 -i *-capture.jpg Event-1.mpg

it gives me this...

001-capture.jpg: Unknown format

If I manually use this command (which ZM is automating)...

sudo /usr/local/bin/ffmpeg -y -hq -intra -r 20.89 -s 640x320 -i %03d-capture.jpg Event-1.mpg

mjpeg: JFIF header found (version: 1.1)
Input #0, image, from '%03d-capture.jpg':
Duration: 00:00:01.9, bitrate: N/A
Stream #0.0: Video: rawvideo, yuvj420p, 640x320, 20.89 fps
Output #0, mpeg, to 'Event-1.mpg':
Stream #0.0: Video: mpeg1video (hq), 640x320, 20.89 fps, q=2-31, 200 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
mjpeg: JFIF header found (version: 1.1)
mjpeg: JFIF header found (version: 1.1)
mjpeg: JFIF header found (version: 1.1)
mjpeg: JFIF header found (version: 1.1)
mjpeg: JFIF header found (version: 1.1)
mjpeg: JFIF header found (version: 1.1)
frame= 6 q=25.0 size= 42kB time=0.3 bitrate=1197.9kbits/s


Now, what is '%03d' and why does * not work in its place? Why is '%03d' only using 6 pictures when it attempts to encode.
JonThompson
Posts: 22
Joined: Wed Feb 09, 2005 4:25 pm

Post by JonThompson »

OK, just needed to google it...

%03d will generate 3 digit numbers starting with 001 in ffmpeg. Unfortunately, zm generates 3 digit numbers until it is a 4 digit number, which means it is impossible to create a mpeg from 3238 jpegs or even 1000 jpegs without changing the mpeg line to %04d and changing all files <1000 to a 4 digit number.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Whether ZM uses 3 or more (or less) digits is a configuration item that can be found at Options->Config->ZM_EVENT_IMAGE_DIGITS. It's set to 3 by default as people who only get a minute or two of images from motion detection probably don't want images with four digits of significance.

Phil
Locked