Video Export Compression/Quality (mpg/wmv/etc.)

Support and queries relating to all previous versions of ZoneMinder
Locked
scottfinman
Posts: 18
Joined: Wed Aug 16, 2006 1:36 pm
Location: Baltimore, MD

Video Export Compression/Quality (mpg/wmv/etc.)

Post by scottfinman »

When creating a video to export (in any of the several formats available; I tried them all) through ffmpeg, the quality is substantially lower than that of the original jpeg images (in particular, grainy with subtle squares showing up). Nothing terrible, but still noticeably worse than the quality that is there to start out with.

I tried passing the "-compression-level 0" parameter through Zoneminder to ffmpeg, as per the ffmpeg documentation, with no noticeable effect on the video quality.

While I realize compression comes in handy for smaller file sizes and quicker responses, the amount of times I create a video from an event is not very often, and it's easier to pass off an event in a single video file to law enforcement when need be.

Any thoughts on how to tackle this, or is this just a reality of the jpeg-to-mpeg/wmv/et al. format jump?
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

Its an mpeg thing mate
I messed a lot with mpeg encoding and you can increase the bitrate from std to much higher settings but the only way i have found to reduce this to (what i deem an acceptable quality) is to match the jpeg bitrate, ie quite high. avi is incompressed though so you may be better using that format?
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
scottfinman
Posts: 18
Joined: Wed Aug 16, 2006 1:36 pm
Location: Baltimore, MD

Passing bit_rate to ffmpeg

Post by scottfinman »

Thanks for pointing me in that direction. It seems that changing the bitrate doesn't seem to make a dent though. In particular, I'm passing "-bit_rate <integer>", as per the ffmpeg documentation, with said integer being everything from 2 bytes/sec to 2 MB/s with no effect on the file size in either .avi or .mpg format (even .avi is showing the fuzzy square effect).

Seems that you have experience with exactly this issue; what settings in particular work for your setup? I presume the appropriate calculation for the jpeg bitrate would be something like 640*480*3 for a color 640x480 image?
scottfinman
Posts: 18
Joined: Wed Aug 16, 2006 1:36 pm
Location: Baltimore, MD

My Bad

Post by scottfinman »

Upon further investigation, the -bit_rate flag was for a different ffmpeg plugin (a lot of flag options to pass through!)...scrolling up a bit in the list gave the proper option of "-b <integer>" to pass in a bitrate in kb - all is well, high quality video now.

Thanks James!
User avatar
AmmarossDanan
Posts: 19
Joined: Tue Jul 03, 2007 10:05 pm
Location: Salt Lake, UT, US

Post by AmmarossDanan »

I've noticed the default output is of rather low quality myself. Maybe you should try this (Options -> Images):
ZM_FFMPEG_OUTPUT_OPTIONS = -r 20 -pass 2 -b 5000k

Works well for me.
Ammaross Danan
control_freak
Posts: 1
Joined: Thu Jun 24, 2010 2:13 am

Post by control_freak »

Thanks this worked for me, I'm very new.

Under Options > Images > FFMPEG_OUTPUT_OPTIONS I put this

-r 25 -b 5000k

now my video exports are high quality. :)
Locked