Opened 20 months ago

Last modified 20 months ago

#10228 new defect

Screen recording on Mac produces a skewed output video

Reported by: zachog Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by zachog)

Doing a screen capture recording on Mac results in a output video file where each line is offset from the prior line. This is the same behavior described in this ticket that was marked as fixed from 4 years ago: https://trac.ffmpeg.org/ticket/5654. However, this reproduces in a build with a build date from yesterday.

How to reproduce:

  1. ffmpeg -f avfoundation -i "0:" out.avi
  2. Press 'q' after a second or two.

Expected:
A video file is produced of the screen contents.

Actual:
A video file is produced but the video contents are skewed and unusable. See attached video file.

Platform is mac OS 11.7.1 Big Sur.

Console output:
ffmpeg version N-109934-g891ed24f77-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2000-2023 the FFmpeg developers

built with Apple clang version 11.0.0 (clang-1100.0.33.17)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
libavutil 58. 3.100 / 58. 3.100
libavcodec 60. 5.100 / 60. 5.100
libavformat 60. 4.100 / 60. 4.100
libavdevice 60. 2.100 / 60. 2.100
libavfilter 9. 4.100 / 9. 4.100
libswscale 7. 2.100 / 7. 2.100
libswresample 4. 11.100 / 4. 11.100
libpostproc 57. 2.100 / 57. 2.100

[AVFoundation indev @ 0x7f9308504540] Configuration of video device failed, falling back to default.
[avfoundation @ 0x7f9308504080] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x7f9308504080] Supported pixel formats:
[avfoundation @ 0x7f9308504080] uyvy422
[avfoundation @ 0x7f9308504080] yuyv422
[avfoundation @ 0x7f9308504080] nv12
[avfoundation @ 0x7f9308504080] 0rgb
[avfoundation @ 0x7f9308504080] bgr0
[avfoundation @ 0x7f9308504080] Overriding selected pixel format to use uyvy422 instead.
[avfoundation @ 0x7f9308504080] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, avfoundation, from '0:':

Duration: N/A, start: 10275.945000, bitrate: N/A
Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 1877x915, 1000k tbr, 1000k tbn

File '/Users/runner/tmp/out.avi' already exists. Overwrite? [y/N] y
Stream mapping:

Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))

Press [q] to stop, ? for help

Attachments (1)

out.avi (1.3 MB ) - added by zachog 20 months ago.
Skewed video file.

Download all attachments as: .zip

Change History (10)

by zachog, 20 months ago

Attachment: out.avi added

Skewed video file.

comment:1 by zachog, 20 months ago

I've tried every option I can find such as setting different pixel_formats, vsync, outputting to raw and then converting, framerate, video_size, etc options and all result in skewed output. If any work around exists I'd be interested in knowing it. Thanks!

comment:2 by zachog, 20 months ago

Description: modified (diff)

comment:3 by zachog, 20 months ago

Description: modified (diff)

comment:4 by zachog, 20 months ago

I did find that lowering the screen resolution fixed the issue but unfortunately that isn't a feasible work around for me. Setting the video_size option to the resolution that works for the lower system resolution did not work to fix the skewed video output.

comment:5 by Balling, 20 months ago

Frame rate : 600.000 FPS

is wrong, you are doing something wrong.

MPEG-4 Visual

No one uses that nowadays, use HEVC or AV1. Same for AVI container, use mp4 also known as mov.

1877x915 is what is your resolution when it is broken?

Last edited 20 months ago by Balling (previous) (diff)

comment:6 by zachog, 20 months ago

I'm not sure why it had a frame rate of 600fps. I didn't specify that. The resolution of the machine is 1656x932.

So after trying dozens of different settings with none of them working I found out that Mac has a built in screencapture application. I gave that a try and found that it had the exact same skewed video problem so it seems like it is an OS/video driver problem rather than a ffmeg problem. This tool had an option to capture a subsection of the screen and I found that if I subtract 1 pixel from the height and width the capture works just fine.

I'm not sure how you would detect if you were on a system with this issue but it would likely save your users a ton of grief if you were able to do the same when you encountered a system with this issue.

comment:7 by Balling, 20 months ago

Mac has a built in screencapture application. I gave that a try and found that it had the exact same skewed video problem so

Or they are just using our naive code.

What macbook is that?

Last edited 20 months ago by Balling (previous) (diff)

comment:8 by zachog, 20 months ago

I couldn't say what they are using under the hood. It is a parallels VM. I didn't set it up so I'm not sure what it is running on.

comment:9 by Balling, 20 months ago

parallels VM.

Then it is for sure using our code.

Note: See TracTickets for help on using tickets.