Record, Convert Then Play

I use AVFoundation input devices to capture the webcam on OS X.

List my device first, such as webcam and microphone.

ffmpeg -f avfoundation -list_devices true -i ""
[AVFoundation input device @ 0x7fb8b0d0f0a0] AVFoundation video devices:
[AVFoundation input device @ 0x7fb8b0d0f0a0] [0] FaceTime HD Camera (Built-in)
[AVFoundation input device @ 0x7fb8b0d0f0a0] [1] Capture screen 0
[AVFoundation input device @ 0x7fb8b0d0f0a0] [2] Capture screen 1
[AVFoundation input device @ 0x7fb8b0d0f0a0] AVFoundation audio devices:
[AVFoundation input device @ 0x7fb8b0d0f0a0] [0] Built-in Microphone

So I know the video device index of webcam is 0.

Just record now!

ffmpeg -f avfoundation -i "0" out.mpg
Input #0, avfoundation, from '0':
  Duration: N/A, start: 3085.239000, bitrate: N/A
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1280x720, 30 tbr, 1000k tbn, 1000k tbc
Output #0, mpeg, to 'out.mpg':
  Metadata:
    encoder         : Lavf57.56.100
    Stream #0:0: Video: mpeg1video, yuv420p, 1280x720, q=2-31, 200 kb/s, 30 fps, 90k tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.64.101 mpeg1video
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg1video (native))
Press [q] to stop, [?] for help
frame=   20 fps=0.0 q=14.1 size=     192kB time=00:00:00.56 bitrate=2775.6kbits/
frame=   36 fps= 35 q=16.9 size=     234kB time=00:00:01.10 bitrate=1742.6kbits/
frame=   52 fps= 33 q=30.4 size=     300kB time=00:00:01.63 bitrate=1504.6kbits/
frame=   67 fps= 32 q=31.0 size=     332kB time=00:00:02.13 bitrate=1274.9kbits/
frame=   83 fps= 32 q=31.0 size=     372kB time=00:00:02.66 bitrate=1142.8kbits/
frame=   99 fps= 31 q=31.0 size=     428kB time=00:00:03.20 bitrate=1095.7kbits/
frame=  115 fps= 31 q=31.0 size=     460kB time=00:00:03.73 bitrate=1009.4kbits/
frame=  117 fps= 31 q=31.0 Lsize=    464kB time=00:00:03.83 bitrate= 991.6kbits/s speed=1.02x    
video:461kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.726507%
Exiting normally, received signal 2.

I can just double click onout.mpgto play it with QuickTime. Or use FFplay to do that.

ffplay out.mpg
Input #0, mpeg, from 'out.mpg':    0KB vq=    0KB sq=    0B f=0/0   
  Duration: 00:00:03.87, start: 0.533333, bitrate: 983 kb/s
    Stream #0:0[0x1e0]: Video: mpeg1video, yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 104857 kb/s, 30 fps, 30 tbr, 90k tbn, 30 tbc
   2.67 M-V:  0.001 fd=   0 aq=    0KB vq=   96KB sq=    0B f=0/0

[Capture webcam on OS X](http://trac.ffmpeg.org/wiki/Capture/Webcam#OSX\

frame rate is not supported

[avfoundation @ 0x7fae8f00bc00] Selected framerate (29.970030) is not supported by the device
[avfoundation @ 0x7fae8f00bc00] Supported modes:
[avfoundation @ 0x7fae8f00bc00]   1280x720@[1.000000 30.000000]fps
    Last message repeated 2 times
[avfoundation @ 0x7fae8f00bc00]   640x480@[1.000000 30.000000]fps
    Last message repeated 2 times
[avfoundation @ 0x7fae8f00bc00]   320x240@[1.000000 30.000000]fps
    Last message repeated 2 times
0: Input/output error

I have to specify the 30 frame rate to input.

Webcam with FFmpeg on Mac: Selected framerate (29.970030) is not supported by the device

results matching ""

    No results matching ""