this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: Address PR review comments

- Update debug test to use BGRA format instead of MJPEG
- Rename test suite to better reflect its purpose
- Update example scripts to demonstrate BGRA as the working format
- Add clear warnings about H264/MJPEG format limitations
- Show real-time FFmpeg conversion examples for BGRA format
- All tests passing successfully

Pedro 6b21bf40 64240d6f

+36 -26
+3 -4
Tests/StreamVideoDebugTest.swift
··· 1 1 import Testing 2 2 import Foundation 3 3 4 - @Suite("Stream Video Debug Tests") 4 + @Suite("Stream Video Basic Functionality Tests") 5 5 struct StreamVideoDebugTests { 6 6 @Test("Stream video command runs without hanging") 7 7 func streamVideoBasicExecution() async throws { ··· 12 12 throw TestError.commandError("No simulator UDID specified") 13 13 } 14 14 15 - // Launch any app to have something on screen 16 - try await TestHelpers.launchPlaygroundApp(to: "tap-test") 15 + // No need to launch app - stream-video captures the simulator screen directly 17 16 18 17 // Create a task to run the command 19 18 let commandTask = Task { 20 19 try await TestHelpers.runAxeCommand( 21 - "stream-video --format mjpeg --fps 1", 20 + "stream-video --format bgra --fps 1", 22 21 simulatorUDID: udid 23 22 ) 24 23 }
+33 -22
examples/stream-video-example.sh
··· 1 1 #!/bin/bash 2 2 3 3 # Example script demonstrating video streaming with AXe 4 + # NOTE: Currently only BGRA format works properly. H264/MJPEG formats have known issues. 4 5 5 6 # Get simulator UDID (use first booted iPhone) 6 7 UDID=$(xcrun simctl list devices | grep "iPhone.*Booted" | head -1 | grep -o "[A-F0-9-]\{36\}") ··· 12 13 13 14 echo "Using simulator: $UDID" 14 15 15 - # Example 1: Stream H264 video to file 16 - echo "Example 1: Streaming H264 video to file for 5 seconds..." 17 - swift run axe stream-video --udid "$UDID" --format h264 --fps 30 > recording.h264 & 16 + # Example 1: Stream BGRA video to file (currently the only working format) 17 + echo "Example 1: Streaming BGRA video to file for 5 seconds..." 18 + echo "Note: BGRA outputs raw pixel data (4 bytes per pixel)" 19 + swift run axe stream-video --udid "$UDID" --format bgra --fps 30 > recording.bgra & 18 20 PID=$! 19 21 sleep 5 20 22 kill -INT $PID 21 23 wait $PID 2>/dev/null 22 - echo "Video saved to recording.h264" 23 - echo "You can play it with: ffplay -f h264 recording.h264" 24 + echo "Video saved to recording.bgra" 25 + echo "To convert to MP4: ffmpeg -f rawvideo -pixel_format bgra -video_size 393x852 -i recording.bgra output.mp4" 24 26 echo "" 25 27 26 - # Example 2: Stream MJPEG to stdout and pipe to ffplay (if available) 27 - if command -v ffplay &> /dev/null; then 28 - echo "Example 2: Streaming MJPEG video to ffplay for real-time viewing..." 29 - echo "Press Ctrl+C to stop" 30 - swift run axe stream-video --udid "$UDID" --format mjpeg --fps 15 --quality 0.5 | ffplay -f mjpeg -i - 2>/dev/null 31 - else 32 - echo "Example 2: ffplay not found. Install ffmpeg to view video in real-time." 33 - echo "You can install it with: brew install ffmpeg" 34 - fi 35 - 36 - # Example 3: Stream with scaling 37 - echo "" 38 - echo "Example 3: Streaming scaled video (50% size) to file..." 39 - swift run axe stream-video --udid "$UDID" --format h264 --scale 0.5 --fps 20 > recording_scaled.h264 & 28 + # Example 2: Show H264 format warning (currently not working) 29 + echo "Example 2: H264 format (WARNING: Currently not functional)" 30 + echo "Note: H264 encoding is broken in FBSimulatorControl. This will show warnings." 31 + swift run axe stream-video --udid "$UDID" --format h264 --fps 30 > test-h264.h264 & 40 32 PID=$! 41 - sleep 3 33 + sleep 2 42 34 kill -INT $PID 43 35 wait $PID 2>/dev/null 44 - echo "Scaled video saved to recording_scaled.h264" 36 + echo "H264 test complete (expected to produce no data)" 37 + rm -f test-h264.h264 38 + 39 + # Example 3: Real-time BGRA to MP4 conversion with FFmpeg 40 + echo "" 41 + if command -v ffmpeg &> /dev/null; then 42 + echo "Example 3: Streaming BGRA and converting to MP4 in real-time..." 43 + swift run axe stream-video --udid "$UDID" --format bgra --fps 10 | \ 44 + ffmpeg -f rawvideo -pixel_format bgra -video_size 393x852 -framerate 10 -i - \ 45 + -c:v libx264 -pix_fmt yuv420p -preset fast \ 46 + -y realtime.mp4 & 47 + PID=$! 48 + sleep 5 49 + kill -INT $PID 50 + wait $PID 2>/dev/null 51 + echo "Real-time video saved to realtime.mp4" 52 + else 53 + echo "Example 3: ffmpeg not found. Install it with: brew install ffmpeg" 54 + echo "Skipping real-time MP4 conversion example." 55 + fi 45 56 46 57 # Cleanup 47 - rm -f recording.h264 recording_scaled.h264 58 + rm -f recording.bgra 48 59 49 60 echo "" 50 61 echo "Video streaming examples completed!"