[FFmpeg-user] Using x11grab to grab two displays simultaneously

Lionel Petit lionelpetit at gmail.com
Wed Aug 7 11:47:46 CEST 2013


Hi,

I have a computer with two screens and I would like to capture the two
displays simultaneously and put the result in a container of 10 minutes
chunks.
The idea is to have the video streams of each display at any time (playing
the video streams of the correct chunk).

Firstly, I have tested with two ffmpeg commands and I have merged the
output in one file (the result is a container file which has 2 video
streams):
The capture commands I used :

./ffmpeg -f x11grab -r 30 -s sxga -i :0.0 -vcodec libx264 -threads 0 -flags
global_header -map 0 -g 300 -f segment -segment_time 600 -reset_timestamps
1 firstScreen-%03d.mkv

./ffmpeg -f x11grab -r 30 -s sxga -i :0.1 -vcodec libx264 -threads 0 -flags
global_header -map 0 -g 300 -f segment -segment_time 600 -reset_timestamps
1 secondScreen-%03d.mkv


Later, I tried to do the same in one command :

ffmpeg -f x11grab -r 30 -s sxga -i :0.0 -f x11grab -r 30 -s sxga -i :0.1
-vcodec libx264 -map 0 -vcodec libx264 -map 1 -threads 0 -flags
global_header -g 300 -f segment -segment_time 600 -reset_timestamps 1
outputFile-%03d.mkv

I prefer this solution because I just have one command line, one container,
I'm sure to have the same 10 minutes and I have nothing to do after the
capture.
But there are some problems of I-frame at the beginning of the streams and
I have to wait few seconds before seeing a whole image.
I try to use the reference_stream option without success.

The questions I have :
- How could I force an I-frame at the beginning of a new segment ?
- Is there an easier solution to do this capture ?
- Do you have advice to help me realize this capture ?

Best regards,

Lionel


More information about the ffmpeg-user mailing list