x11grab video stalls every 30 seconds in screencapture

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

x11grab video stalls every 30 seconds in screencapture

Troy Gardner
We are using latest ffmpeg, for screencapture in the cloud.

We are seeing odd dropped frame stalls in video capture every 30 seconds
for about 1-2 seconds in duration.
Audio is captured without stalls, and  Audio Video sync is perfectly fine
despite stalls.

Hoping someone had ideas, this is driving us nuts and there's nothing
obvious to explain it.

This is the capture setting we are using.
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1024x768 -i :0.0  -acodec
libvorbis -ar 44100 -vcodec libx264 -preset ultrafast -gp 0 -threads 0
ffg4.mkv

This is the a drop frame test case capture  with lossless x264 that shows
dropped frames around 25-26 and significant stall errors at 30 and 60
seconds
http://66.220.0.170/XFG4.mkv

We get this trying different options, like keyframes.

This is the output  with flashsrv, which shows  similar pause around 23 and
53 seconds, and indicates it's not a libx264 specific issue.
flashsrv http://66.220.0.170/out.mov


This is running on an instance with 16 vcpu + 16gb ram, on the Amazon AWS
 there is no noticeable background process that we can see at least that
would explaing
and happens regardless if it's debian, or ubuntu.


This is the version of ffmpeg.
ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 26 2012 12:42:06 with gcc 4.7.1
  configuration: --arch=x86_64 --enable-avfilter --enable-vdpau
--enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex
--enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib
--disable-stripping --enable-gpl --enable-postproc --enable-swscale
--enable-x11grab --enable-libdc1394 --enable-shared --disable-static
--enable-libx264 --enable-libvpx --enable-libmp3lame --enable-libfaac
--enable-nonfree --enable-libopencore-amrwb --enable-libopencore-amrnb
--enable-version3
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: x11grab video stalls every 30 seconds in screencapture

Paul B Mahol
On 6/26/12, Troy Gardner <[hidden email]> wrote:
> We are using latest ffmpeg, for screencapture in the cloud.

And older version had same issue?

I ask because recently code for multithreaded demuxing have been added.

>
> We are seeing odd dropped frame stalls in video capture every 30 seconds
> for about 1-2 seconds in duration.
> Audio is captured without stalls, and  Audio Video sync is perfectly fine
> despite stalls.
>
> Hoping someone had ideas, this is driving us nuts and there's nothing
> obvious to explain it.
>
> This is the capture setting we are using.
> ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1024x768 -i :0.0  -acodec
> libvorbis -ar 44100 -vcodec libx264 -preset ultrafast -gp 0 -threads 0
> ffg4.mkv
>
> This is the a drop frame test case capture  with lossless x264 that shows
> dropped frames around 25-26 and significant stall errors at 30 and 60
> seconds
> http://66.220.0.170/XFG4.mkv
>
> We get this trying different options, like keyframes.
>
> This is the output  with flashsrv, which shows  similar pause around 23 and
> 53 seconds, and indicates it's not a libx264 specific issue.
> flashsrv http://66.220.0.170/out.mov
>
>
> This is running on an instance with 16 vcpu + 16gb ram, on the Amazon AWS
>  there is no noticeable background process that we can see at least that
> would explaing
> and happens regardless if it's debian, or ubuntu.
>
>
> This is the version of ffmpeg.
> ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
>   built on Jun 26 2012 12:42:06 with gcc 4.7.1
>   configuration: --arch=x86_64 --enable-avfilter --enable-vdpau
> --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex
> --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib
> --disable-stripping --enable-gpl --enable-postproc --enable-swscale
> --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
> --enable-libx264 --enable-libvpx --enable-libmp3lame --enable-libfaac
> --enable-nonfree --enable-libopencore-amrwb --enable-libopencore-amrnb
> --enable-version3
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

FFmpeg and RTMPT

Julien Baumgarten
Hello everyone,

I have a question about FFmpeg. I know that it works with RTMP streams but does it works with RTMPT streams?
I tried to make it work through Xuggler but I do not succeed to make it work with RTMPT.

Is it "normal"?

Yours sincerely,
Julien
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: x11grab video stalls every 30 seconds in screencapture

Troy Gardner
In reply to this post by Paul B Mahol
On Tue, Jun 26, 2012 at 7:38 AM, Paul B Mahol <[hidden email]> wrote:

> On 6/26/12, Troy Gardner <[hidden email]> wrote:
> > We are using latest ffmpeg, for screencapture in the cloud.
>
> And older version had same issue?
>

Hard to say.

We had an earlier version in production created about a year ago that works
fine, but it has many differences: it  used FLV for capture, an much older
version of Ubuntu/ffmpeg and the video was much less demanding so it's
possible that glitches happened but didn't show up.

We've made upgrades everywhere, and this intermittent new one has only
recently showed up as we don't normally check more than a couple seconds of
video in qa, and it's intermittent sometimes the glitch is not noticeable,
it's only now we've created the test case to really show the issue.

Given the rapid stream of updates in ffmpeg, ubuntu, codecs, it's taken us
awhile just to see this issue clearly, and have some idea of where it's at.



> I ask because recently code for multithreaded demuxing have been added.
>

Is there a flag to turn on/off to test?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: FFmpeg and RTMPT

Meftah Tayeb
In reply to this post by Julien Baumgarten
please compile it with librtmp support

----- Original Message -----
From: "Julien BAUMGARTEN" <[hidden email]>
To: "FFmpeg user questions and RTFMs" <[hidden email]>
Sent: Tuesday, June 26, 2012 5:43 PM
Subject: [FFmpeg-user] FFmpeg and RTMPT


> Hello everyone,
>
> I have a question about FFmpeg. I know that it works with RTMP streams but
> does it works with RTMPT streams?
> I tried to make it work through Xuggler but I do not succeed to make it
> work with RTMPT.
>
> Is it "normal"?
>
> Yours sincerely,
> Julien
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 6830 (20120126) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>


__________ Information from ESET NOD32 Antivirus, version of virus signature database 6830 (20120126) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: FFmpeg and RTMPT

Julien Baumgarten
Are you sure that is works with RTMPT?
My ffmpeg version was compiled with --librtmp-enable or something like that.

Yours sincerely,
Julien BAUMGARTEN

Le 26 juin 2012 à 18:12, Meftah Tayeb a écrit :

> please compile it with librtmp support
>
> ----- Original Message ----- From: "Julien BAUMGARTEN" <[hidden email]>
> To: "FFmpeg user questions and RTFMs" <[hidden email]>
> Sent: Tuesday, June 26, 2012 5:43 PM
> Subject: [FFmpeg-user] FFmpeg and RTMPT
>
>
>> Hello everyone,
>>
>> I have a question about FFmpeg. I know that it works with RTMP streams but does it works with RTMPT streams?
>> I tried to make it work through Xuggler but I do not succeed to make it work with RTMPT.
>>
>> Is it "normal"?
>>
>> Yours sincerely,
>> Julien
>> _______________________________________________
>> ffmpeg-user mailing list
>> [hidden email]
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>>
>> __________ Information from ESET NOD32 Antivirus, version of virus signature database 6830 (20120126) __________
>>
>> The message was checked by ESET NOD32 Antivirus.
>>
>> http://www.eset.com
>>
>>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 6830 (20120126) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: x11grab video stalls every 30 seconds in screencapture

Star Brilliant
In reply to this post by Troy Gardner
 > We are using latest ffmpeg, for screencapture in the cloud.
 >
 > We are seeing odd dropped frame stalls in video capture every 30 seconds
 > for about 1-2 seconds in duration.
 > Audio is captured without stalls, and  Audio Video sync is perfectly fine
 > despite stalls.
 >
 > Hoping someone had ideas, this is driving us nuts and there's nothing
 > obvious to explain it.
 >
 > This is the capture setting we are using.
 > ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1024x768 -i :0.0  
-acodec
 > libvorbis -ar 44100 -vcodec libx264 -preset ultrafast -gp 0 -threads 0
 > ffg4.mkv
 >
 > This is the a drop frame test case capture  with lossless x264 that shows
 > dropped frames around 25-26 and significant stall errors at 30 and 60
 > seconds
 > http://66.220.0.170/XFG4.mkv
 >
 > We get this trying different options, like keyframes.
 >
 > This is the output  with flashsrv, which shows similar pause around
23 and
 > 53 seconds, and indicates it's not a libx264 specific issue.
 > flashsrv http://66.220.0.170/out.mov
 >
 >
 > This is running on an instance with 16 vcpu + 16gb ram, on the Amazon AWS
 >  there is no noticeable background process that we can see at least that
 > would explaing
 > and happens regardless if it's debian, or ubuntu.
 >
 >
 > This is the version of ffmpeg.
 > ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
 >   built on Jun 26 2012 12:42:06 with gcc 4.7.1
 >   configuration: --arch=x86_64 --enable-avfilter --enable-vdpau
 > --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex
 > --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib
 > --disable-stripping --enable-gpl --enable-postproc --enable-swscale
 > --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
 > --enable-libx264 --enable-libvpx --enable-libmp3lame --enable-libfaac
 > --enable-nonfree --enable-libopencore-amrwb --enable-libopencore-amrnb
 > --enable-version3


I have been experiencng this problem as well. After it stalls, the video and
audio lost sync. However I noticed that my HDD LED flashes when the video
stalls.
I think that perhaps Linux kernel is trying to write buffered data to
HDD, which
caused delay.
I wonder if there is a way to switch to write-through mode.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: x11grab video stalls every 30 seconds in screencapture

Carl Eugen Hoyos
Star Brilliant <b13253 <at> gmail.com> writes:

>  > ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1024x768
>  > -i :0.0 -acodec libvorbis -ar 44100 -vcodec libx264
>  > -preset ultrafast -gp 0 -threads 0 ffg4.mkv

> I have been experiencng this problem as well. After it
> stalls, the video and audio lost sync.

Could you test with -threads 1 ?
That should at least improve the situation.

Is it fine if you record a (very) small resolution?

Generally, please always add your command line and
complete, uncut console output.

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: x11grab video stalls every 30 seconds in screencapture

Star Brilliant
On 2013-06-07- 17:31, Carl Eugen Hoyos wrote:

> Star Brilliant <b13253 <at> gmail.com> writes:
>
>>   > ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1024x768
>>   > -i :0.0 -acodec libvorbis -ar 44100 -vcodec libx264
>>   > -preset ultrafast -gp 0 -threads 0 ffg4.mkv
>> I have been experiencng this problem as well. After it
>> stalls, the video and audio lost sync.
> Could you test with -threads 1 ?
> That should at least improve the situation.
>
> Is it fine if you record a (very) small resolution?
>
> Generally, please always add your command line and
> complete, uncut console output.
>
> Carl Eugen

Sorry, I acturally was replying this message:
https://lists.ffmpeg.org/pipermail/ffmpeg-user/2012-June/007505.html
I quoted the original mail but forgot to add a description above it.
So sorry for the inconvenience.

The problem is not only about the libx264 codec.
I tried with ffv1 / huffyuv / utvideo, the screencasting seemed fine at
the beginning,
but it started to lose frames (and lost audio sync) in a minute or later.
Sometimes, especially with lossless codec, I experience stall with HDD
LED flashing.


_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: x11grab video stalls every 30 seconds in screencapture

Troy Gardner
In reply to this post by Star Brilliant
Anybody ever figure out a solution on this?


On Thu, Jun 6, 2013 at 11:47 PM, Star Brilliant <[hidden email]> wrote:

> > We are using latest ffmpeg, for screencapture in the cloud.
> >
> > We are seeing odd dropped frame stalls in video capture every 30 seconds
> > for about 1-2 seconds in duration.
> > Audio is captured without stalls, and  Audio Video sync is perfectly fine
> > despite stalls.
> >
> > Hoping someone had ideas, this is driving us nuts and there's nothing
> > obvious to explain it.
> >
> > This is the capture setting we are using.
> > ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1024x768 -i :0.0
>  -acodec
> > libvorbis -ar 44100 -vcodec libx264 -preset ultrafast -gp 0 -threads 0
> > ffg4.mkv
> >
> > This is the a drop frame test case capture  with lossless x264 that shows
> > dropped frames around 25-26 and significant stall errors at 30 and 60
> > seconds
> > http://66.220.0.170/XFG4.mkv
> >
> > We get this trying different options, like keyframes.
> >
> > This is the output  with flashsrv, which shows similar pause around 23
> and
> > 53 seconds, and indicates it's not a libx264 specific issue.
> > flashsrv http://66.220.0.170/out.mov
> >
> >
> > This is running on an instance with 16 vcpu + 16gb ram, on the Amazon AWS
> >  there is no noticeable background process that we can see at least that
> > would explaing
> > and happens regardless if it's debian, or ubuntu.
> >
> >
> > This is the version of ffmpeg.
> > ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
> >   built on Jun 26 2012 12:42:06 with gcc 4.7.1
> >   configuration: --arch=x86_64 --enable-avfilter --enable-vdpau
> > --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex
> > --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib
> > --disable-stripping --enable-gpl --enable-postproc --enable-swscale
> > --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
> > --enable-libx264 --enable-libvpx --enable-libmp3lame --enable-libfaac
> > --enable-nonfree --enable-libopencore-amrwb --enable-libopencore-amrnb
> > --enable-version3
>
>
> I have been experiencng this problem as well. After it stalls, the video
> and
> audio lost sync. However I noticed that my HDD LED flashes when the video
> stalls.
> I think that perhaps Linux kernel is trying to write buffered data to HDD,
> which
> caused delay.
> I wonder if there is a way to switch to write-through mode.
>
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: x11grab video stalls every 30 seconds in screencapture

hirschhornsalz
If the stall happens exactly every 30 seconds, it is most likely from the linux kernel, which does a dirty page writeback if a page gets older than 30 seconds.
If the amount of memory written in 30 sec is to big, the writeback may last significantly longer the a frame (33 msec) and you lose frames.

You can try either
echo 100 > /proc/sys/vm/dirty_expire_centisecs
echo 100 > /proc/sys/vm/dirty_writeback_centisecs

for a writeback every second (possibly a even lower value)
or, if you have lots of RAM (more than the size of the screencast)

echo 60000 >  /proc/sys/vm/dirty_expire_centisecs
echo 60000 > /proc/sys/vm/dirty_writeback_centisecs
echo 90 > /proc/sys/vm/dirty_background_ratio
echo 90 > /proc/sys/vm/dirty_ratio

for completely avoiding writeback fpr 10 minutes worth of screencast.