Skip to content
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

Add shell command media source drivers #468

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add shell command media source drivers #468

wants to merge 1 commit into from

Conversation

KW-M
Copy link
Contributor

@KW-M KW-M commented Jan 20, 2023

Description

New drivers to allow the use of shell command output as a video or audio source (+ tests and example code).

  • This can be used in cases where command line programs support media sources that pion mediadevices doesn't yet
  • Examples: using libcamera based cameras with libcamera-video, or to add filters to a video or audio stream before pion mediadevices using ffmpeg or gstreamer.

Reference issue

Workaround for #407

  • People using a Raspberry Pi can use a shell command like the following as a video input source with frame format I420
    libcamera-vid --width 640 --height 480 --framerate 16 --codec yuv420 --flush 1 --timeout 0 --nopreview 1 --output -
  • This PR does not address new for hardware encoding on the Raspberry Pi, however non-hardware encoders h264 & vp8/vp9 work fine for now.

@codecov
Copy link

codecov bot commented Jan 20, 2023

Codecov Report

Base: 58.21% // Head: 54.84% // Decreases project coverage by -3.38% ⚠️

Coverage data is based on head (1d228e0) compared to base (f8f8511).
Patch coverage: 0.86% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #468      +/-   ##
==========================================
- Coverage   58.21%   54.84%   -3.38%     
==========================================
  Files          62       66       +4     
  Lines        3683     3913     +230     
==========================================
+ Hits         2144     2146       +2     
- Misses       1412     1640     +228     
  Partials      127      127              
Impacted Files Coverage Δ
pkg/driver/cmdsource/audiocmd.go 0.00% <0.00%> (ø)
pkg/driver/cmdsource/videocmd.go 0.00% <0.00%> (ø)
pkg/frame/framesize.go 0.00% <0.00%> (ø)
pkg/driver/cmdsource/cmdsource.go 3.33% <3.33%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

New drivers to allow the use of shell command output
as a video or audio source.
Added tests and example code for this driver.
This can be used in cases where command line programs
support media sources that pion/mediadevices doesn't yet
(EG: libcamera based cameras), or to add filters to a video or audio
stream before pion/mediadevices using ffmpeg or gstreamer.
@KW-M KW-M marked this pull request as draft January 20, 2023 04:24
@KW-M KW-M marked this pull request as ready for review January 20, 2023 04:32
@KW-M
Copy link
Contributor Author

KW-M commented Jan 23, 2023

I'm not quite sure why the test cases for audiocmd.go and videocmd.go don't show up in Codecov. I'm fairly new to testing in go / testing in general, so any pointers would be much appreciated.

@at-wat
Copy link
Member

at-wat commented Jan 24, 2023

I'm not quite sure why the test cases for audiocmd.go and videocmd.go don't show up in Codecov. I'm fairly new to testing in go / testing in general, so any pointers would be much appreciated.

https://github.com/pion/mediadevices/actions/runs/3964689614/jobs/6793835936#step:5:259

audiocmd_test.go:63: ffmpeg command not found in path. Skipping test. Err:  exec: "ffmpeg": executable file not found in $PATH

@stv0g stv0g added the enhancement New feature or request label Jan 31, 2023
@stv0g stv0g changed the title Add shell command media source drivers (New Feature) Add shell command media source drivers Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants