[FFmpeg-user] Best way to record video on a computer with a really bad CPU yet really good GPU?

Sven C. Dack sven.c.dack at sky.com
Sat Sep 10 20:21:40 EEST 2016


On 04/09/16 12:57, Andy Furniss wrote:
> ...
> Good to know - I had -r pasted away in my notes.
>
> So in terms of benchmarking it seems to replace -r needs use of vsync 2
> - it's horrible without when asking for high fps, but current git does
> warn to use it.
>
> For me cpus forced to perf I get -
>
> ffmpeg -vsync 2 -framerate 200 -f x11grab -s 1920x1080 -i :0.0 -vframes 1000 
> -f null -
>
> frame= 1000 fps=138 q=-0.0 Lsize=N/A time=00:00:07.24 bitrate=N/A speed=   1x
>
> ffmpeg -vsync 2 -framerate 200 -f x11grab -s 1920x1080 -i :0.0 -vframes 1000 
> -pix_fmt yuv420p -f null -
>
> frame= 1000 fps= 47 q=-0.0 Lsize=N/A time=00:00:21.27 bitrate=N/A speed=   1x
>
> ffm -vsync 2 -framerate 200 -f x11grab -s 1920x1080 -i :0.0 -vframes 1000 
> -pix_fmt nv12 -f null -
>
> frame= 1000 fps= 33 q=-0.0 Lsize=N/A time=00:00:30.41 bitrate=N/A speed=0.999x
>
> Which is a quite low (IIRC I managed to get gstreamer to do 60).
>
> My h/w enc needs nv12 and is capable of 2160p60 real time.
>
> Of course it may do 444 just it's not implemented and I guess doing the
> CSC on the GPU would be another way to go. 

For those who haven't followed the developers mailing list; this has improved 
with the latest git. One can stream in H.264 and H.265 from a 1920x1080 desktop 
with a frame rate well above 60Hz (~100fp/s with an Nvidia GeForce GTX 960). 
Anyone who has never tried it and wants to can test it on Twitch.TV: 1.) Create 
an account, 2.) go to the dashboard, 3.) reveal the streaming key and 4.) run 
ffmpeg:

$ export KEY="live_0123456789_aBcDeFgH...." # keep it secret - don't stream the 
command line arguments or it will show up on the video
$ ffmpeg -f x11grab -s hd1080 -framerate 200 -i :0.0 -c:v h264_nvenc -rc cbr 
-b:v 500k -f flv -y "rtmp://live.justin.tv/app/$KEY"

Takes a minute before it comes live (with a video delay of about 10 seconds) and 
then one can watch one's desktop on Twitch.TV and share it with others. Note, 
Twitch currently only accepts H.264 CBR with bit rates of up to 3.5mbit. The bit 
rate should be set so it can fit through one's uplink speed, which depending on 
ISPs may require adjusting.

To watch the stream on Twitch.TV with HTML5 requires the URL 
"http://player.twitch.tv/?channel=$ACCOUNT&html5" where $ACCOUNT is the account 
name on Twitch. Under options can one bring up a status window, which will 
confirm the frame rate (as just now tested did it show a frame rate of 80-100 
fps for me).

Sven



More information about the ffmpeg-user mailing list