New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added OS X Screen Capture device #75
Conversation
this breaks build on linux |
The reason is that 'avcapture' doesn't disable itself on non-OS X platforms. I've briefly looked around, but I cannot figure out why it does that. Maybe someone with more experience can help... |
I figured it out and added the necessary change to configure. |
@@ -14,6 +14,8 @@ OBJS-$(CONFIG_ALSA_INDEV) += alsa-audio-common.o \ | |||
OBJS-$(CONFIG_ALSA_OUTDEV) += alsa-audio-common.o \ | |||
alsa-audio-enc.o | |||
OBJS-$(CONFIG_AVFOUNDATION_INDEV) += avfoundation.o | |||
OBJS-$(CONFIG_AVCAPTURE_INDEV) += avcapture.o | |||
OBJS-$(CONFIG_AVFOUNDATION_INDEV) += avfframereceiver.o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge this line with
OBJS-$(CONFIG_AVFOUNDATION_INDEV) += avfoundation.o
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, alphabetical order.
I have fixed the requested changes. |
OBJS-$(CONFIG_AVFOUNDATION_INDEV) += avfoundation.o | ||
OBJS-$(CONFIG_AVCAPTURE_INDEV) += avcapture.o | ||
OBJS-$(CONFIG_AVFOUNDATION_INDEV) += avfoundation.o \ | ||
avfframereceiver.o |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No tabs are allowed in FFmpeg.
Ok, have a look again. Thanks. |
I've updated the code to merge appropriately with master branch. |
I've added a blog post about using this device. See it here: http://www.benden.us/journal/2014/avcapture-mac-os-x-screen-recording/ |
Hello, I have been using the merge since it launched and it works great in Maveriks. Thank you very much for this sensational contribution. The only thing is that I could not set up the audio with OpenAL. Try to do the same to set it but I could not. I'm using SOX a python script with multhreding to capture audio and video simultaneously. Thank you very much. |
Your branch contains commits that add conflict markers like "<<<<<<< HEAD", which are later removed in seperate commits, also it contains a seemingly random merge of ffmpeg master. |
Ok, I will clean up the commit. On a side note, should I add audio capture support to this module? It might be better than using sox. Thoughts? |
sure, if you like to add audio support. |
Ok, I cleaned up the merges. Can you merge it easily now? |
yes, but it seem/would breaks build on linux |
I fixed the Linux build problem. I am getting a linking error though. Not sure if it is due to code rot or if there is a problem. I'm researching this matter. |
It seems the updated configure script fixed the linking issues. I am about to test and commit audio support to this device. |
should lock/unlock_frames() not be static inline ? |
I changed them to static inline. I have a branch ready for testing that includes audio support. It is working locally, but has a few pops and clicks. I'm not sure of why it is doing this. Can anyone offer advise? The branch is located here: https://github.com/jbenden/FFmpeg/tree/avcapture-audio |
As far as the sound branch goes, if you set the rate to 30; everything seems much better. So there is some sort of disconnect between the two streams rates (the video rate verses audio rate). |
YEA!!! OPENAL |
This introduces a lot of code redundancy by introducing the avcapture device. I think the avfoundation device should be extended to include the display inputs. Also the audio issues can be solved for all inputs in one device. |
I now have a branch where I've merged avcapture with avfoundation. https://github.com/jbenden/FFmpeg/tree/avfoundation It experiences the same troubles that plagued avcapture; namely that the frame rate must be fixed at 30 or the sound is sped up. Additionally, it does NOT seem as if any of the arguments passed to ffmpeg are honored - I had to hard code my device indexes to even test this out. |
I'm currently adapting your changes but need some more days to do it. |
I've just posted a patch to ffmpeg-devel. |
How come the command-line arguments are still not read? I still have to hard-code a video_device_index to use and list_devices doesn't work. Is it my copy or a general problem? |
I've updated to the latest code, still it doesn't read the command-line options for avfoundation correctly. |
In case people are curious, the FFmpeg mailing list post is here: https://ffmpeg.org/pipermail/ffmpeg-devel/2014-October/164470.html |
Thilo, you have an off by one calculation in listing supported devices. In the for loop for desktop screens, it should be i + index + 1. |
I teste yesterday on a mini with no video devices so maybe this is true. Will test again later today. I used: -i "#" and -i "Captire screen #" which are working for me. What command line does not work as expected for you? |
ffmpeg -f avfoundation -i "" -list_devices true This does not list the available devices, like it should. |
In that case -list_devices is interpreted as an output option. Move it bevore -i "". |
That did the trick! (Note I patched the n+1 problem in display enumeration) → ffmpeg -f avfoundation -list_devices true -i "" 10/25 @ 07:15 |
Your fix of the device listing works only if there are video devices available... Fixed differently and updated the patch on ffmpeg-devel. Thanks! |
applied thilos patch, |
Hello, thank you very much for the help. I compiled the new version of the branch-avcapure audio. These are devices that shows me the system: [AVFoundation input device @ 0x7faf53d0cfe0] AVFoundation video devices: But I have doubts on how to execute the command. I need to capture video of your screen and audio from the microphone, but the camera is triggered and recording the screen but with many interruptions: ffmpeg -i -f avcapture '0' -i -f avfoundation '0' /Users/user/5.mkv as to differentiate avfoundation [0] Built-in Microphone and not [0] in iSight Use this version https://github.com/jbenden/FFmpeg/tree/avfoundation since the master does not recognize my microphone. Thank you very much! |
Interesting, on what hardware are you operating? For the command, use |
Hi! Thank you very much for answering. I'm on a macbook pro with mavericks. I apologize if I did not understand. I need to capture video from my desk and microphone audio. Thanks again |
For screen capturing you should use current git HEAD. If the microphone is an issue with git HEAD, then please report this issue in detail - best would be to open a new ticket on trac.ffmpeg.org if you think it is a bug. |
Ok... Muchas gracias!!!!! |
@davidherran I suspect you accidentally switched the
The P.S. ¿Hablas español? |
Yes, I am from Colombia, how are you? I take and I tell ... finished compiling FFMPEG master version, and success !!! recorded video and audio from my desk ... but I deleted audio frames ... audio cuts out and comes back when I play video. I'm on a Mac book pro with mavericks. use this command: ffmpeg_master avfoundation -f -i '1: 0' /Users/user/1.mkv Greetings from Colombia !!!! Si, soy de Colombia, como estás? Aprovecho y te cuento... acabe de compilar la versión master de FFMPEG, y éxito!!! grabo video de mi escritorio y audio... pero me borra frames de audio... el audio se corta y regresa cuando reproduzco el video. Estoy en un Mac book pro con mavericks. use este comando: ffmpeg_master -f avfoundation -i '1:0' /Users/user/1.mkv Saludos de Colombia!!!! |
Hola David, No hablo español mucho ni lo hablo bien porque es mi segundo año aprendiendo español en mi escuela. Vivo en los Estados Unidos, pero soy de China, y español es mi tercera idioma. Hay muchos mexicanos aquí en California y español es muy útil. Voy a (give you) unas instrucciones para debugar el problema en inglés, pero pienso @thiloborgmann sabe más en el sujeto. Saludos de Los Ángeles, y por favor corregir mi (writing)! Hi David, Spanish is my third language so I'm not really good at it. Please correct me in any way you could! I suspect the order of
and
and report back? Just so you know, the first number is the video device while the second is the audio device. You don't have a video device If you still get some error, could you post the log of the failed command? It will help us debug the problem. @thiloborgmann Two questions I have here:
|
|
Hello and of course with pleasure ... my English is also very bad, so excuse me ... Hola David, Use new version of FFMPEG master with the command -> ffmpeg_master -f avfoundation -list_devices true -i "" and this is the list of devices that I have: [AVFoundation input device @ 0x7fe40b50d060] AVFoundation video devices: to execute the command ffmpeg_master -f avfoundation -i '1:0' /Users/user/1.mkv Capture great video from my desktop, but the audio has cut frames. that's the thing ... |
add -r 30 to the list of arguments. This helps my recordings. |
@jbenden Hello and tks... please see the example in video http://youtu.be/d8kfFlh_yeg Command: ffmpeg_master -f avfoundation -i '1:0' -r 30 /Users/davidherran/1.mkv |
Well the sync is OK now, but there is popping clicks in the audio. I'm not sure why that's happening, maybe @thiloborgmann can shed some light on the situation. |
ok. thats is correct, this is the correct term or word "popping" tks |
This pull request adds a new device, avcapture, that allows one to capture the primary display on OS X.