Capture video Macbook webcam with cpu accelerated

ffmpeg -f avfoundation -framerate 30 -video_size 1280x720 -pix_fmt uyvy422 -i "0" -c:v h264_videotoolbox -profile:v high -b:v 3M -color_range 1 /tmp/out.mp4
Captures video from webcam and encodes it using the accelerated hardware provided by videotoolbox framework. It takes about 20% cpu in a i5 2015 macbook air.
Sample Output
(after Ctrl-C)
Output #0, mp4, to '/tmp/out.mp4':
    encoder         : Lavf57.71.100
    Stream #0:0: Video: h264 (h264_videotoolbox) ([33][0][0][0] / 0x0021), yuv420p(tv), 1280x720, q=2-31, 3000 kb/s, 30 fps, 15360 tbn, 30 tbc
      encoder         : Lavc57.89.100 h264_videotoolbox
frame=  144 fps= 40 q=-0.0 Lsize=    1907kB time=00:00:04.76 bitrate=3277.4kbits/s dup=39 drop=0 speed=1.33x    
video:1906kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.073948%
Exiting normally, received signal 2.

2018-01-08 10:28:42

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: