Add shell command media source drivers
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 Report
Base: 58.21% // Head: 54.84% // Decreases project coverage by -3.38% :warning:
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.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
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.
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