Skip to content

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

❌ Patch coverage is 0.86957% with 228 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.84%. Comparing base (f8f8511) to head (1d228e0).
⚠️ Report is 138 commits behind head on master.

Files with missing lines Patch % Lines
pkg/driver/cmdsource/audiocmd.go 0.00% 82 Missing ⚠️
pkg/driver/cmdsource/videocmd.go 0.00% 67 Missing ⚠️
pkg/driver/cmdsource/cmdsource.go 3.33% 58 Missing ⚠️
pkg/frame/framesize.go 0.00% 21 Missing ⚠️
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              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

3 participants