How to solve delay when capturing desktop?

For the developers that use FFmpeg in their software.
Post Reply
navedjobs
Posts: 19
Joined: Sun Jun 10, 2012 3:18 pm

How to solve delay when capturing desktop?

Post by navedjobs » Sun Jun 17, 2012 5:34 pm

I m sucessfully able to capture desktop using ffmpeg and "screen capture recorder" full command is as follows

Code: Select all

ffmpeg -f dshow -i video="screen-capture-recorder" -r 55 -s 520x400
 capture.flv
and for playing

Code: Select all

ffplay capture.flv
but with frame rate 55 i m getting delay of almost 7-10 seconds. Delay in-the-sence the ffplay displays the captured stuff about 7-10 seconds late . do you guys have any work around's to solve this ?

ramiro
Posts: 157
Joined: Tue May 10, 2011 12:56 am

Re: How to solve delay when capturing desktop?

Post by ramiro » Mon Jun 18, 2012 4:16 am

ffmpeg and ffplay will buffer up data to try and find out what kind of stream it's dealing with. it gives up after a while and that's when the stream really starts. I had sent a patch some long time ago to the ffmpeg-devel mailinglist regarding that but it seems it never got applied (?). rogerdpack has more info on this =)

rogerdpack
Posts: 1878
Joined: Fri Aug 05, 2011 9:56 pm

Re: How to solve delay when capturing desktop?

Post by rogerdpack » Mon Jun 18, 2012 3:56 pm

so you are trying to play that file *as it is recorded*?
-r

navedjobs
Posts: 19
Joined: Sun Jun 10, 2012 3:18 pm

Re: How to solve delay when capturing desktop?

Post by navedjobs » Mon Jun 18, 2012 4:57 pm

rogerdpack wrote:so you are trying to play that file *as it is recorded*?
-r
Thanks but i have solved most of my problem now my real problem is filter screen capture recorder which takes 100% cpu usage all time it is in execution , My cpu configuration is AMD anthlon 2.8 ghz 2gb ram 32 bit windows home edition
does the cpu usage is because of my low configuration ? or is something else ?
please help

rogerdpack
Posts: 1878
Joined: Fri Aug 05, 2011 9:56 pm

Re: How to solve delay when capturing desktop?

Post by rogerdpack » Mon Jun 18, 2012 6:33 pm

So the problem is that you can't afford 100% cpu?

I have compiled my notes about streaming to this page:

http://ffmpeg.org/trac/ffmpeg/wiki/StreamingGuide

There may be some options that are useful to you in there, like

-tune zerolatency

navedjobs
Posts: 19
Joined: Sun Jun 10, 2012 3:18 pm

Re: How to solve delay when capturing desktop?

Post by navedjobs » Tue Jun 19, 2012 2:55 pm

rogerdpack wrote:So the problem is that you can't afford 100% cpu?

I have compiled my notes about streaming to this page:

http://ffmpeg.org/trac/ffmpeg/wiki/StreamingGuide

There may be some options that are useful to you in there, like

-tune zerolatency
hi rogerd and thanks for the help , but this command also is taking 100% cpu usage plus
" ffplay " is not able to play what he is getting over the UDP port

Code: Select all

ffmpeg -f dshow -i video="screen-capture-recorder" -vcodec libx264 -tune zerolatency -b 900k -f mpegts udp://myip:1234
I receive this error by ffmpeg and streaming is aborted

Code: Select all

Press [q] to stop, [?] for help
[dshow @ 01CE8BA0] real-time buffer 170% full! frame dropped!
    Last message repeated 291 times
[mpegts @ 02F4AA20] Application provided invalid, non monotonically increasing dts to muxer in stream
0: 1 >= 1
av_interleaved_write_frame(): Invalid argument
[dshow @ 01CE8BA0] real-time buffer 170% full! frame dropped!
    Last message repeated 1 times
whereas ffplay shows this error

Code: Select all

[mpegts @ 030fbb00] Unable to seek back to the start

rogerdpack
Posts: 1878
Joined: Fri Aug 05, 2011 9:56 pm

Re: How to solve delay when capturing desktop?

Post by rogerdpack » Thu Aug 09, 2012 1:30 pm

So you're streaming it to udp then using ffplay to receive it?
What's your full command line and uncut console outputs for both?
(current hunch: not enough cpu to do what you're wanting/trying to do...)

Post Reply
'