Creating videos with ffmpeg when FPS is below 25

Support and queries relating to all previous versions of ZoneMinder
ekiboy69
Posts: 101
Joined: Tue Jun 22, 2004 9:26 pm
Location: Kaarina-Finland

Creating videos with ffmpeg when FPS is below 25

Post by ekiboy69 »

Hello,

This issue has been spread out in various threads for a long time, one of the latest being

http://www.zoneminder.com/forums/viewtopic.php?t=4013

In order to use ZM professionally this would be a problem to solve. Therefore I think the subject deserves a separate thread.

Problem: by default ffmpeg refuses to generate a video when the frame rate is below the standard (24 or 25 AFAIK). This situation is usual when using surveillance cameras.

It is possible to circumvent this by using the -strict -1 parameter in the ffmpeg command line. This method however creates a video clip that does not conform to MPEG2 specification and therefore does not work in commercial (windows) players and codecs even if it would work with Linux players.

The -strict parameter is poorly documented in the ffmpeg documentation. It is only said that values -1, 0 and 1 may be given. But what do they actually do?

Does anyone know a way to create a video (whatever video format is OK) when the FPS rate is well below the 25 FPS rate so that

1) it would be compatible with the standard?
2) the video would maintain the time sync (a second in the ZM screen clock would be a second when playing the video)?

I have a way to do this using command line using mpeg2enc but without the timestamps in the ZM database. Therefore the time sync does not work with this method.

In my opinion the ability of exporting stardards compliant video is needed when you need to take the clip of a burglar etc. to police that is using WinXP with Windows Media Player.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

i second this but have been able to play back 0.4.9 ffmpeg created mpegs in media player without problems. I would prefer a better media player and wouldnt have an issue telling customers that they need 9realpayer gsplayer whatever) to playback zm mpegs (for the time being anyway). Unfortunaly ffmpeg is still a beta piece of software and as such i assume changes in the way it works each release. AFAIK 0.4.8 ffmmpeg works correctly, and if Phil changes zm to work with 0.4.9 there will be another issue when 0.5 comes out.
So to my point. Is there another means of creating video that is on a non beta release that we can use as an ecoder, even if we cant use m$ media player. I have seen mention of ogg in other threads?. I dont think the issue of not using m$ media player is a huge one as virtually all comercial recorders use their own software to playback video. As long as we have a reliable place to download it and give this address to people that need to view any zm video.

JAmes
ekiboy69
Posts: 101
Joined: Tue Jun 22, 2004 9:26 pm
Location: Kaarina-Finland

Post by ekiboy69 »

jameswilson wrote:i second this but have been able to play back 0.4.9 ffmpeg created mpegs in media player without problems.
Are you saying that you are able to view videos that are created with ffmpeg 0.4.9 and
1) the original framerate (in the ZM database) is less that 25 FPS
2) and you have created the videos using the "ffmpeg -strict -1" method

To me it seems that the problems begin when both of these apply.
jameswilson wrote:I would prefer a better media player and wouldnt have an issue telling customers that they need 9realpayer gsplayer whatever) to playback zm mpegs (for the time being anyway).
The problem is not only the lacks and other downsides of WMP. The same thing goes for other SW too , RealPlayer for instance. It is very much possible that Linux & Open Source software can tolerate streams that are beyond the specification. That however is not a good argument for not following the standard.

In my opinion the video clips should be exportable in some standard video format. The file should be viewable by customers, police, courts, insurance companies and other technically less talented bodies and people without downloading any software. Now it does not seem to be possible.

I am trying to get some clips into Adobe Premiere for editing. Seems to be really tricky.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

The fact they cant be edited to me is a plus! lol

Yes using 0.4.9 using strict method i can view mpegs in media player. What libffmpeg are you using?

I can create a vid tonight and send it you if you like and confirm the 0.4.9 whan i get home etc

James
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I would just mention that ZM does support ffmpeg 0.4.9 but unfortunately the data structures have changed again since the beta release. Also unfortunately the version number hasn't changed so there is no way for the ZM build scripts to figure out what they should do. There is also no guarantee that it won't change again today, and again tomorrow, so it's very difficult to track.

There is a movement afoot amongst several open source authors that use ffmpeg to try and get the ffmpeg development teams to formalise some kind of release schedule or timeline but I don't know how far along that is. The ffmpeg people can be a bit of a finickity lot as well so it might never get off the ground.

Phil
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

well there confidence for you lol. Can we (i say we god knows why i cant do anything with it lol)/you use another encoder for mpeg or isnt there one thats any good?

James
ekiboy69
Posts: 101
Joined: Tue Jun 22, 2004 9:26 pm
Location: Kaarina-Finland

Well, I thought ffmpeg was state of the art...

Post by ekiboy69 »

jameswilson wrote:well there confidence for you lol. Can we (i say we god knows why i cant do anything with it lol)/you use another encoder for mpeg or isnt there one thats any good?

James
LOL

Well, I thought Phil had a reason to choose ffmpeg as the primary encoder. I also thought mpeg_enc was a dying piece of sw.

Well - maybe I'll try that instead. Is there a RPM for the latest LiveCD version around? I tried to browse with MCC but could not find any packages including mpeg_enc.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

let me know how it goes. Its the mpeg streaming is all i have an issue with now. I built mine from prm's so i can send you the rpm's i used if there are multiple different ones floating around

James
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

after 30 seconds of searching i found this. It appears i can crete a script to creat mpegs, i will have a play tonight when i get home but i may be way off as i aint tried out like this before. I assume i can use it from that command line to create a video of the 10 minute segment from zm. It details this in a howto....

http://mjpeg.sourceforge.net/

James

https://sourceforge.net/docman/display_ ... 5776#ss4.1
ekiboy69
Posts: 101
Joined: Tue Jun 22, 2004 9:26 pm
Location: Kaarina-Finland

Thank you!

Post by ekiboy69 »

jameswilson wrote:after 30 seconds of searching i found this.
Thank you! I will try this!
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I've spent a few hours on this today and have managed to get ZM to correctly detect CVS ffmpeg sources and use the new formats. So it should be possible (at least until they change it all again) to use ZM with CVS ffmpeg if anyone wants to try it. As the ffmpeg developers have all but abandoned the formal release there may well be an enormous amount of differences in what you get out.

If anyone wants it I can post a patch, otherwise it will be in the next release. Also note that I've not actually checked it actually works yet, just compiles.

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

Post by cordel »

Phil,
If you would like, I can get the current version in CVS and Package it for Fedora so that we have that snapshot always available. I can also keep the source up on my FTP.
I captured todays CVS just in case :D
Regards,
Cordel
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

id love to try but patching im scared lol
If you need guinea pigs ill volunteer as always

James
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Patching is pretty simple James so don't be afraid :D

Corey, I think that would be a good idea. However I think I'd better test it first before I commit :lol:

Phil
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

ok bring it on ill learn lol
Oh phil i have some kit for you as donation ill pm you if you like

James
Locked