@@ -152,6 +152,111 @@ jobs:
152152 run : exit 1
153153 runs-on : ubuntu-22.04
154154
155+ ivs :
156+ name : " FFmpeg with AWS IVS"
157+ # The IVS test requires AWS credentials, which is not available for pull requests.
158+ if : github.event_name != 'pull_request'
159+ # needs: build
160+ steps :
161+ - name : Configure AWS credentials
162+ uses : aws-actions/configure-aws-credentials@v4
163+ with :
164+ aws-access-key-id : ${{ secrets.AWS_IVS_AKID }}
165+ aws-secret-access-key : ${{ secrets.AWS_IVS_AKSECRET }}
166+ aws-region : us-west-2
167+ - name : Checkout repository
168+ uses : actions/checkout@v4
169+ - name : Create IVS Participant Token
170+ id : create-token
171+ run : |
172+ set -euo pipefail
173+
174+ sudo apt-get update
175+ sudo apt-get install -y jq
176+
177+ # Set duration in minutes, default is 720 (12 hours).
178+ echo "::add-mask::${{ secrets.AWS_IVS_STAGE }}"
179+ TOKEN=$(aws ivs-realtime create-participant-token\
180+ --region us-west-2 \
181+ --user-id publisher-user --capabilities PUBLISH \
182+ --stage-arn "${{ secrets.AWS_IVS_STAGE }}" \
183+ --duration 10 |jq -r '.participantToken.token')
184+
185+ echo "::add-mask::$TOKEN"
186+ echo "token=${TOKEN}" >> $GITHUB_OUTPUT
187+ echo "IVS token is $TOKEN"
188+ - name : Download Test File
189+ run : |
190+ set -euxo pipefail
191+ curl -s -L -O https://github.com/ossrs/ffmpeg-webrtc/releases/download/pre-release/bbb-4mbps-baseline-opus.mp4
192+ - name : Build FFmpeg
193+ run : |
194+ set -euo pipefail
195+
196+ # Install dependencies
197+ sudo apt-get update
198+ sudo apt-get install -y nasm pkg-config libssl-dev libopus-dev libx264-dev
199+
200+ # Build FFmpeg with WebRTC support
201+ ./configure --enable-muxer=whip --enable-openssl --enable-version3 \
202+ --enable-libx264 --enable-gpl --enable-libopus
203+ make -j$(nproc)
204+ ./ffmpeg -version && ./ffmpeg -muxers 2>/dev/null |grep whip
205+ - name : Streaming with FFmpeg
206+ run : |
207+ set -euo pipefail
208+ TOKEN="${{ steps.create-token.outputs.token }}"
209+ nohup ./ffmpeg -t 30 -re -i bbb-4mbps-baseline-opus.mp4 -c copy \
210+ -f whip -authorization "$TOKEN" "https://global.whip.live-video.net" \
211+ 1>ffstdout.log 2>ffstderr.log &
212+ - name : Check IVS Streaming
213+ id : streaming
214+ run : |
215+ set -euo pipefail
216+
217+ # Check streams in IVS.
218+ for ((i=0; i<10; i++)); do
219+ SESSION=$(aws ivs-realtime list-stage-sessions \
220+ --region us-west-2 --stage-arn "${{ secrets.AWS_IVS_STAGE }}" \
221+ --query 'stageSessions[?endTime==`null`]' |jq -r '.[0]?.sessionId')
222+
223+ STREAM=""
224+ if [[ "$SESSION" != "" && "$SESSION" != "null" ]]; then
225+ STREAM=$(aws ivs-realtime list-participants \
226+ --region us-west-2 --stage-arn "${{ secrets.AWS_IVS_STAGE }}" \
227+ --session-id "${SESSION}" --filter-by-published |jq -r '.participants[0].participantId')
228+ fi
229+
230+ if [[ "$STREAM" != "" ]]; then
231+ echo 'Test OK';
232+ echo "has_stream=true" >> $GITHUB_OUTPUT
233+ break;
234+ fi
235+ sleep 3
236+ done
237+
238+ if [[ "$STREAM" == "" ]]; then
239+ echo "Stream not found: $STREAM"
240+ echo "has_stream=false" >> $GITHUB_OUTPUT
241+ fi
242+ - name : Stop FFmpeg normally
243+ run : |
244+ pkill -SIGINT ffmpeg && sleep 3 ||
245+ echo "FFmpeg process not found or already stopped."
246+ - name : Show FFmpeg Stdout Log
247+ run : cat ffstdout.log
248+ - name : Show FFmpeg Stderr Log
249+ run : cat ffstderr.log
250+ - name : Check FFmpeg Exit Log
251+ run : |
252+ set -euo pipefail
253+ cat ffstderr.log |grep 'Exiting normally' && exit 0
254+ echo "Exiting normally not found in ffstderr.log" && exit 1
255+ - name : Check Stream Existence
256+ if : ${{ steps.streaming.outputs.has_stream == 'false' }}
257+ run : exit 1
258+ runs-on : ubuntu-22.04
259+
155260 asan :
156261 name : " FFmpeg with Asan"
157262 needs : build
@@ -705,6 +810,7 @@ jobs:
705810 needs :
706811 - fate
707812 - srs
813+ - ivs
708814 - asan
709815 - openssl-1-0-1k
710816 - openssl-1-0-2
0 commit comments