Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#6111 closed defect (duplicate)

macOS AVFoundation screen capture looks awful but FaceTime HD Cam capture fine

Reported by: mixelpix Owned by: thilo.borgmann
Priority: normal Component: avdevice
Version: git-master Keywords: avfoundation
Cc: mixelpix@mac.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Per https://trac.ffmpeg.org/wiki/Capture/Desktop#OSX
I am using AVfoundation (https://ffmpeg.org/ffmpeg-devices.html#avfoundation) to capture video and the following capture of the desktop results in an unuseable picture:

$ ffmpeg -f avfoundation -i "1:none" desktop.mov
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)

No image "DesktopCapture.png" attached to Ticket #6111

As a comparison, a similar command for capturing the internal FaceTime? HD Camera results in a useable picture:

$ ffmpeg -f avfoundation -i "0:none" facetime_cam.mov

No image "FaceTimeHDCameraCapture.png" attached to Ticket #6111

NOTE: 3.2.2 is not an option in the New Ticket >> Version pulldown menu

Attachments (4)

desktop.jpg (295.2 KB) - added by mixelpix 3 years ago.
camera.jpg (188.4 KB) - added by mixelpix 3 years ago.
desktop.2.jpg (40.3 KB) - added by mixelpix 3 years ago.
desktop.3.jpg (40.3 KB) - added by mixelpix 3 years ago.

Download all attachments as: .zip

Change History (17)

Changed 3 years ago by mixelpix

Changed 3 years ago by mixelpix

comment:1 Changed 3 years ago by thilo.borgmann

  • Resolution set to invalid
  • Status changed from new to closed

Thanks for a comprehensive report.

However, just check your output codec parameters and tune for quality as you like. The default can look quite bad. See the docs for details.

comment:2 Changed 3 years ago by mixelpix



comment:3 Changed 3 years ago by thilo.borgmann

  • Keywords avfoundation added
  • Resolution invalid deleted
  • Status changed from closed to reopened

Ok this is another problem sorry, reopening.

comment:4 Changed 3 years ago by thilo.borgmann

  • Owner set to thilo.borgmann
  • Status changed from reopened to open

comment:5 follow-up: Changed 3 years ago by thilo.borgmann

Please send a log for
$ ffmpeg -f avfoundation -list_devices true -i ""

What model is it?

For a workaround you might try to specify another pixel format.

comment:6 in reply to: ↑ 5 Changed 3 years ago by mixelpix

Replying to thilo.borgmann:

Please send a log for
$ ffmpeg -f avfoundation -list_devices true -i ""

$  ffmpeg -f avfoundation -list_devices true -i ""
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-chromaprint --enable-ffplay --enable-frei0r --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libebur128 --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopus --enable-librtmp --enable-librubberband --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-libzmq --enable-opencl --enable-openssl --enable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2/include/openjpeg-2.1 --enable-nonfree --enable-vda
  libavutil      55. 34.100 / 55. 34.100
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.100 / 57. 56.100
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
[AVFoundation input device @ 0x7fc2db40f240] AVFoundation video devices:
[AVFoundation input device @ 0x7fc2db40f240] [0] FaceTime HD Camera (Built-in)
[AVFoundation input device @ 0x7fc2db40f240] [1] Capture screen 0
[AVFoundation input device @ 0x7fc2db40f240] [2] Capture screen 1
[AVFoundation input device @ 0x7fc2db40f240] AVFoundation audio devices:
[AVFoundation input device @ 0x7fc2db40f240] [0] Built-in Microphone
: Input/output error
$

What model is it?

per Sys Info:

FaceTimeHD Camera (Built-in):

Model ID: UVC Camera VendorID_1452 ProductID_34064
Unique ID: 0x1a11000005ac8510

For a workaround you might try to specify another pixel format.

Thank you for the suggestion. I am just getting started reading the documentation and have purchased Frantisek Korbel's book. Can you recommend a capture setting? I have to step away from the computer for about 8 hours but will check back later tonight - thanks again!

comment:7 Changed 3 years ago by mixelpix

Not sure why ffmpeg -f avfoundation -list_devices true -i "" results in an i/o error? I did have an odd experience installing ffmpeg with Homebrew - perhaps this is related? I've documented it here: http://apple.stackexchange.com/questions/270842/error-with-homebrew-install-of-ffmpeg-with-all-options

Also, with the install there was a "caveat" message re: Homebrew's Python install while "Pouring" libcaca-0.99b19.sierra.bottle.1.tar.gz
Does avfoundation make use of Python at runtime?

Also, "Pouring" libsamplerate-0.1.9.sierra.bottle.tar.ga generated a caveat msg about needing libsndfile

Thanks again!

comment:8 in reply to: ↑ description ; follow-ups: Changed 3 years ago by cehoyos

Replying to mixelpix:

NOTE: 3.2.2 is not an option in the New Ticket >> Version pulldown menu

That's because only current FFmpeg git head is supported on this bug tracker (even more so for macos where no release support exists). Please test it and provide your command line together with the complete, uncut console output to make this a valid ticket.

comment:9 in reply to: ↑ 8 Changed 3 years ago by mixelpix

Replying to cehoyos:

Replying to mixelpix:

NOTE: 3.2.2 is not an option in the New Ticket >> Version pulldown menu

That's because only current FFmpeg git head is supported on this bug tracker (even more so for macos where no release support exists).

Sorry, I was unaware that macOS has no release support.
Apologies, I don't know what you mean by "FFmpeg git head"


Please test it

I used Homebrew to install FFmpeg - do you mean I should reinstall with the --HEAD option (per https://trac.ffmpeg.org/wiki/CompilationGuide/MacOSX#ffmpegthroughHomebrew) and retry the capture?

Last edited 3 years ago by mixelpix (previous) (diff)

Changed 3 years ago by mixelpix

Changed 3 years ago by mixelpix

comment:10 in reply to: ↑ 8 Changed 3 years ago by mixelpix

Replying to cehoyos:

Please test it and provide your command line together with the complete, uncut console output to make this a valid ticket.

I've reinstalled FFmpeg with the --HEAD option:

$ brew install ffmpeg --HEAD

...and this is the entire console output from capturing my desktop with AV Foundation

$  ffmpeg -f avfoundation -i "1:none" desktop.mov
ffmpeg version git-2017-01-31-3405d6c Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3405d6c --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 45.100 / 55. 45.100
  libavcodec     57. 75.100 / 57. 75.100
  libavformat    57. 66.101 / 57. 66.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 72.100 /  6. 72.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[avfoundation @ 0x7fc803802600] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7fc803802600] Supported pixel formats:
[avfoundation @ 0x7fc803802600]   uyvy422
[avfoundation @ 0x7fc803802600]   yuyv422
[avfoundation @ 0x7fc803802600]   nv12
[avfoundation @ 0x7fc803802600]   0rgb
[avfoundation @ 0x7fc803802600]   bgr0
[avfoundation @ 0x7fc803802600] Overriding selected pixel format to use uyvy422 instead.
Input #0, avfoundation, from '1:none':
  Duration: N/A, start: 87118.887667, bitrate: N/A
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1366x768, 30 tbr, 1000k tbn, 1000k tbc
No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x7fc803834e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7fc803834e00] profile High 4:2:2, level 3.2, 4:2:2 8-bit
[libx264 @ 0x7fc803834e00] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mov, to 'desktop.mov':
  Metadata:
    encoder         : Lavf57.66.101
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv422p, 1366x768, q=-1--1, 30 fps, 15360 tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.75.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=  382 fps= 29 q=-1.0 Lsize=     951kB time=00:00:12.63 bitrate= 616.5kbits/s dup=6 drop=0 speed=0.953x    
video:945kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.554439%
[libx264 @ 0x7fc803834e00] frame I:2     Avg QP:19.70  size:204812
[libx264 @ 0x7fc803834e00] frame P:98    Avg QP:22.37  size:  5188
[libx264 @ 0x7fc803834e00] frame B:282   Avg QP:33.66  size:   175
[libx264 @ 0x7fc803834e00] consecutive B-frames:  1.0%  1.0%  1.6% 96.3%
[libx264 @ 0x7fc803834e00] mb I  I16..4: 12.7% 44.1% 43.2%
[libx264 @ 0x7fc803834e00] mb P  I16..4:  0.2%  0.6%  0.6%  P16..4:  7.3%  1.1%  0.8%  0.0%  0.0%    skip:89.5%
[libx264 @ 0x7fc803834e00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  2.4%  0.1%  0.0%  direct: 0.0%  skip:97.4%  L0:25.9% L1:73.6% BI: 0.5%
[libx264 @ 0x7fc803834e00] 8x8 transform intra:44.7% inter:72.7%
[libx264 @ 0x7fc803834e00] coded y,uvDC,uvAC intra: 71.4% 83.6% 81.3% inter: 0.7% 1.6% 0.3%
[libx264 @ 0x7fc803834e00] i16 v,h,dc,p:  3% 91%  0%  6%
[libx264 @ 0x7fc803834e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  5% 84%  8%  0%  0%  0%  2%  0%  1%
[libx264 @ 0x7fc803834e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  4% 73%  9%  0%  1%  0%  9%  0%  3%
[libx264 @ 0x7fc803834e00] i8c dc,h,v,p: 35% 62%  2%  1%
[libx264 @ 0x7fc803834e00] Weighted P-Frames: Y:3.1% UV:3.1%
[libx264 @ 0x7fc803834e00] ref P L0: 64.7%  9.2% 22.6%  3.0%  0.5%
[libx264 @ 0x7fc803834e00] ref B L0: 83.8% 14.2%  2.0%
[libx264 @ 0x7fc803834e00] ref B L1: 95.7%  4.3%
[libx264 @ 0x7fc803834e00] kb/s:607.85
$

...and this is the result:


comment:11 follow-ups: Changed 3 years ago by cehoyos

  • Resolution set to duplicate
  • Status changed from open to closed
  • Version changed from unspecified to git-master

This is a duplicate of ticket #5654.

comment:12 in reply to: ↑ 11 Changed 3 years ago by mixelpix

Thank you for your help - I will check out ticket #5654

comment:13 in reply to: ↑ 11 Changed 3 years ago by mixelpix

Thank you for your help - I will check out ticket #5654

Note: See TracTickets for help on using tickets.