[FFmpeg-user] ffmpeg stuck grabbing the screen

Martin Ždila m.zdila at gmail.com
Mon Feb 27 12:29:33 EET 2017


On Mon, Feb 27, 2017 at 11:08 AM, Carl Eugen Hoyos <ceffmpeg at gmail.com>
wrote:

> Please test current FFmpeg git head.
>

I will and let you know.


> What happens if you use "-f null -" instead of output.mp4: Does it also
> hang?
>

It looks even worse:

ffmpeg -y -loglevel debug -video_size 320x340 -framerate 25 -f x11grab -i
:0.0+100,200 -f null -
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --enable-nonfree --enable-gpl --enable-version3
--enable-x11grab --cpu=native --enable-libx264 --enable-libpulse
--enable-libfdk-aac
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-video_size' ... matched as AVOption 'video_size' with
argument '320x340'.
Reading option '-framerate' ... matched as AVOption 'framerate' with
argument '25'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'x11grab'.
Reading option '-i' ... matched as input url with argument ':0.0+100,200'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'null'.
Reading option '-' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url :0.0+100,200.
Applying option f (force format) with argument x11grab.
Successfully parsed a group of options.
Opening an input file: :0.0+100,200.
[x11grab @ 0x2ff4500] Probe buffer size limit of 5000000 bytes reached
[x11grab @ 0x2ff4500] Stream #0: not enough frames to estimate rate;
consider increasing probesize
Input #0, x11grab, from ':0.0+100,200':
  Duration: N/A, bitrate: N/A
    Stream #0:0, 12, 1/1000000: Video: rawvideo, 1 reference frame (BGR[0]
/ 0x524742), bgr0, 320x340, 0/1, 25 fps, 1000k tbr, 1000k tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: output url -.
Applying option f (force format) with argument null.
Successfully parsed a group of options.
Opening an output file: -.
Successfully opened the file.
detected 1 logical cores
[graph 0 input from stream 0:0 @ 0x30005e0] Setting 'video_size' to value
'320x340'
[graph 0 input from stream 0:0 @ 0x30005e0] Setting 'pix_fmt' to value '298'
[graph 0 input from stream 0:0 @ 0x30005e0] Setting 'time_base' to value
'1/1000000'
[graph 0 input from stream 0:0 @ 0x30005e0] Setting 'pixel_aspect' to value
'0/1'
[graph 0 input from stream 0:0 @ 0x30005e0] Setting 'sws_param' to value
'flags=2'
[graph 0 input from stream 0:0 @ 0x30005e0] Setting 'frame_rate' to value
'25/1'
[graph 0 input from stream 0:0 @ 0x30005e0] w:320 h:340 pixfmt:bgr0
tb:1/1000000 fr:25/1 sar:0/1 sws_param:flags=2
[AVFilterGraph @ 0x30003c0] query_formats: 3 queried, 2 merged, 0 already
done, 0 delayed
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf57.56.101
    Stream #0:0, 0, 1/25: Video: wrapped_avframe, 1 reference frame, bgr0,
320x340, 0/1, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.64.101 wrapped_avframe
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per
stream)
[rawvideo @ 0x2ffdd00] PACKET SIZE: 435200, STRIDE: 1280
    Last message repeated 12 times
[null @ 0x2ffe1a0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 11 >= 0
[rawvideo @ 0x2ffdd00] PACKET SIZE: 435200, STRIDE: 1280
[null @ 0x2ffe1a0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 11 >= 0
[rawvideo @ 0x2ffdd00] PACKET SIZE: 435200, STRIDE: 1280
[null @ 0x2ffe1a0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 11 >= 0
[rawvideo @ 0x2ffdd00] PACKET SIZE: 435200, STRIDE: 1280
[null @ 0x2ffe1a0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 11 >= 0
...

If x11grab for whatever reason provides vfr video, mov is not the ideal
> output format. (It shouldn't though.)
>

In production we actually use:

ffmpeg -hide_banner -y -thread_queue_size 512 -video_size 1024x576
-framerate 25 -draw_mouse 0 -f x11grab -i :0.0 -f pulse -i
1rG1v9twJZz1mDrweRQnKI.monitor -map 0:v -map 1:a -vf format=yuv420p -vcodec
libx264 -acodec libfdk_aac -preset veryfast -profile:v main -level 3.1
/tmp/1rG1v9twJZz1mDrweRQnKI.mp4

But it stucks at 3th frame (unless we provide -r 25).

-- 
Martin Ždila


More information about the ffmpeg-user mailing list