{"action":"created","issue":{"url":"https://api.github.com/repos/mikeboers/PyAV/issues/92","labels_url":"https://api.github.com/repos/mikeboers/PyAV/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/mikeboers/PyAV/issues/92/comments","events_url":"https://api.github.com/repos/mikeboers/PyAV/issues/92/events","html_url":"https://github.com/mikeboers/PyAV/issues/92","id":78479289,"number":92,"title":"Document `av.open` and relationship to libavdevice","user":{"login":"cefn","id":159819,"avatar_url":"https://avatars.githubusercontent.com/u/159819?v=3","gravatar_id":"","url":"https://api.github.com/users/cefn","html_url":"https://github.com/cefn","followers_url":"https://api.github.com/users/cefn/followers","following_url":"https://api.github.com/users/cefn/following{/other_user}","gists_url":"https://api.github.com/users/cefn/gists{/gist_id}","starred_url":"https://api.github.com/users/cefn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cefn/subscriptions","organizations_url":"https://api.github.com/users/cefn/orgs","repos_url":"https://api.github.com/users/cefn/repos","events_url":"https://api.github.com/users/cefn/events{/privacy}","received_events_url":"https://api.github.com/users/cefn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mikeboers/PyAV/labels/docs","name":"docs","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-20T11:06:54Z","updated_at":"2015-05-21T10:42:23Z","closed_at":null,"body":"Because the Pymedia project seems to be dead, I'm trying to identify maintained python libraries for audio recording, encoding and playback to be run on a Raspberry Pi. Sorry if this question doesn't count as an 'issue' and I'm happy to raise it elsewhere if that's more appropriate.\r\n\r\nI've struggled to find reference material within the PyAV api reference which relates to opening and recording an audio stream from a device (e.g. a microphone) equivalent to [http://pymedia.org/tut/src/voice_recorder.py.html](http://pymedia.org/tut/src/voice_recorder.py.html)\r\n\r\nIn fact I'm finding it hard to find a reference to even av.open(...) is that because this python implementation mirrors some other API somewhere that I can refer to?\r\n\r\nIs there any existing facility for recording from audio devices through PyAV, or would it have to be constructed from scratch? \r\n\r\nDoes it make sense to wire, pyaudio, alsa or oss directly into PyAV? If so, which signatures in the API should I be looking at?\r\ne.g. [Pulseaudio/Pyaudio](http://stackoverflow.com/questions/892199/detect-record-audio-in-python) [OSS](http://code.activestate.com/recipes/577587-record-and-playbac-using-standard-python/) [ALSA](http://stackoverflow.com/questions/1936828/how-get-sound-input-from-microphone-in-python-and-process-it-on-the-fly)\r\n\r\nAny other suggested routes to achieving the same functionality with a maintained python library?"},"comment":{"url":"https://api.github.com/repos/mikeboers/PyAV/issues/comments/104222432","html_url":"https://github.com/mikeboers/PyAV/issues/92#issuecomment-104222432","issue_url":"https://api.github.com/repos/mikeboers/PyAV/issues/92","id":104222432,"user":{"login":"cefn","id":159819,"avatar_url":"https://avatars.githubusercontent.com/u/159819?v=3","gravatar_id":"","url":"https://api.github.com/users/cefn","html_url":"https://github.com/cefn","followers_url":"https://api.github.com/users/cefn/followers","following_url":"https://api.github.com/users/cefn/following{/other_user}","gists_url":"https://api.github.com/users/cefn/gists{/gist_id}","starred_url":"https://api.github.com/users/cefn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cefn/subscriptions","organizations_url":"https://api.github.com/users/cefn/orgs","repos_url":"https://api.github.com/users/cefn/repos","events_url":"https://api.github.com/users/cefn/events{/privacy}","received_events_url":"https://api.github.com/users/cefn/received_events","type":"User","site_admin":false},"created_at":"2015-05-21T10:42:23Z","updated_at":"2015-05-21T10:42:23Z","body":"Thanks, @mikeboers \r\n\r\nDo you know what reference or tool can I use to understand the endpoints offered up by my specific libavdevice configuration? ```avfoundation``` is mac-specific so I'd have to investigate other options targeting Debian (raspbian) but I don't know where to begin.\r\n\r\nIf I'm right then the 'path' is actually ```:0``` (indicating the input from the first soundcard? where is this convention established? I need to get input from a bluetooth headset). ```avfoundation``` is a format identifier telling libav how to interpret the data which comes through when the ```:0```path is chosen, all handled in av.open() creating a decoding pipeline. The ```packet``` is actually a generator for frames of a given substream.  An ffplay process is lazily created on the first frame from a given stream's packet and decoded frames of bytes coming from the packet's generator is passed through to ffplay via STDIN to make sound if the \"play\" option is chosen (relying on the decode process having produced bytes which can be interpreted as raw wav).\r\n\r\nI've tried to investigate open(...) in more detail, but at some point I guess I need to be looking at some libav documentation to find available options. Do you know where I can do this? I arrived at https://www.ffmpeg.org/doxygen/2.2/group__lavf__decoding.html#ga10a404346c646e4ab58f4ed798baca32 but no joy finding different values. Looks like the underlying header is https://www.ffmpeg.org/doxygen/2.2/avformat_8h_source.html but I don't know how to figure out how the names of valid formats which can be handled by an InputContainer. Any suggestions?\r\n\r\nP.S. From my forensics so far I'd like to share that It's extremely hard to follow through all the extra non-functional code, and all the indirection which arises from argparser in decode.py, compared to an example invoked by python and not by the shell. Along the 'self-documenting' line I wonder if examples like decode.py could be separated into some minimally functional python (e.g. a Decode class with PyAV operations in it, which can be easily identified and traced, even maybe reused). A simple minimal python invocation could be offered with hard-coded values which do something. Separately an invocation could be shared with all the printed logging+argument handling to configure and trigger every part of the class's functionality. Argument parsing and logging dominates the code at present and obfuscates the access to PyAV so doesn't represent the goodness of the PyAV project as well as it might."}}