Add FFmpeg agentic workflow with setup guide and example#1931
Add FFmpeg agentic workflow with setup guide and example#1931
Conversation
|
Agentic Changeset Generator triggered by this pull request. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| @@ -0,0 +1,170 @@ | |||
| # FFmpeg Agentic Workflows | |||
There was a problem hiding this comment.
Done. Deleted FFMPEG_README.txt file.
| @@ -0,0 +1,269 @@ | |||
| --- | |||
| # FFmpeg Setup Instructions | |||
There was a problem hiding this comment.
Done. Renamed ffmpeg-setup.md to ffmpeg.md.
| sudo apt-get update && sudo apt-get install -y ffmpeg | ||
|
|
||
| # Verify installation | ||
| ffmpeg -version | ||
| ``` |
There was a problem hiding this comment.
Done. Moved bash installation commands to frontmatter steps array. The Setup FFmpeg step now automatically runs before the agent.
|
|
||
| # FFmpeg Usage Guide | ||
|
|
||
| ## Installing FFmpeg |
There was a problem hiding this comment.
@copilot remove section as we are adding steps in the front matter to install ffmpeg
There was a problem hiding this comment.
Done. Removed the "Installing FFmpeg" section since installation is now handled by the frontmatter steps.
| ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 input.mp4 | ||
| ``` | ||
|
|
||
| ## Best Practices |
There was a problem hiding this comment.
Done. Removed the Best Practices and Error Handling sections to keep the file focused on essential operations. File reduced from 200 to 149 lines.
…atter, add opus for transcription Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
|
||
| FFmpeg has been installed and is available in your PATH. | ||
|
|
||
| ## Finding FFmpeg |
There was a problem hiding this comment.
Done. Removed the "Finding FFmpeg" section.
|
|
||
| # FFmpeg Usage Guide | ||
|
|
||
| FFmpeg has been installed and is available in your PATH. |
There was a problem hiding this comment.
@copilot add that /tmp/gh-aw/ffmpeg temp folder is available
There was a problem hiding this comment.
Done. Added documentation that /tmp/gh-aw/ffmpeg temp folder is available for caching intermediate results.
| # Extract audio as WAV (uncompressed) | ||
| ffmpeg -i input.mp4 -vn -acodec pcm_s16le output.wav | ||
|
|
||
| # Extract audio as AAC | ||
| ffmpeg -i input.mp4 -vn -acodec aac -ab 128k output.aac |
There was a problem hiding this comment.
Done. Removed WAV and AAC audio extraction examples, keeping only MP3 and Opus (for transcription).
| ## References | ||
|
|
||
| - FFmpeg Official Documentation: https://ffmpeg.org/documentation.html | ||
| - FFmpeg Wiki: https://trac.ffmpeg.org/wiki | ||
| - Opus Codec Documentation: https://opus-codec.org/ |
There was a problem hiding this comment.
Done. Removed the References section.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done. Added |
|
|
||
| # FFmpeg Usage Guide | ||
|
|
||
| FFmpeg has been installed and is available in your PATH. A temporary folder `/tmp/gh-aw/ffmpeg` is available for caching intermediate results. |
There was a problem hiding this comment.
@copilot "ffmpeg and ffprobe" . Add version step output to specify the version.
There was a problem hiding this comment.
Done. Updated to say "FFmpeg and ffprobe" and added step output to capture the version.
| - name: Setup FFmpeg | ||
| run: | | ||
| sudo apt-get update && sudo apt-get install -y ffmpeg | ||
| ffmpeg -version |
There was a problem hiding this comment.
Done. Added step id and version output using $GITHUB_OUTPUT. The version can be accessed via ${{ steps.setup-ffmpeg.outputs.version }}.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| description: 'URL to video file (must be publicly accessible)' | ||
| required: true | ||
| type: string | ||
| audio_format: |
There was a problem hiding this comment.
Done. Removed the audio-extractor workflow entirely as requested in the follow-up comment.
| @@ -0,0 +1,174 @@ | |||
| --- | |||
There was a problem hiding this comment.
Done. Removed audio-extractor.md and audio-extractor.lock.yml.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| description: 'URL to video file to analyze (must be publicly accessible)' | ||
| required: true | ||
| type: string | ||
| analysis_type: |
There was a problem hiding this comment.
Done. Removed analysis_type input field. Workflow now always performs full analysis including keyframes, scenes, and audio.
| ## Important Notes | ||
|
|
||
| ### Performance Considerations | ||
| - Process operations sequentially to avoid memory issues | ||
| - Clean up intermediate files to save disk space | ||
| - Monitor GitHub Actions runner resources | ||
| - Consider file size limits for uploads/artifacts | ||
|
|
||
| ### Error Handling | ||
| - Verify video download succeeded before processing | ||
| - Check ffmpeg commands return success (exit code 0) | ||
| - Validate output files exist and are not empty | ||
| - Report any errors clearly in the issue | ||
|
|
||
| ### Best Practices from GenAIScript Implementation | ||
| 1. **Caching**: Store results to avoid reprocessing | ||
| 2. **Concurrency**: Process one video at a time | ||
| 3. **Formats**: Use JPG for frames (good quality/size balance) | ||
| 4. **Thresholds**: Scene detection works best at 0.3-0.5 | ||
| 5. **Quality**: Use CRF 23 for good balance of quality/size | ||
| 6. **Timestamps**: Be precise with timestamp-based extraction | ||
| 7. **Size control**: Always specify output dimensions when needed | ||
|
|
||
| ### Security Considerations | ||
| - Only process videos from trusted sources | ||
| - Validate input URLs before downloading | ||
| - Set reasonable timeout limits | ||
| - Monitor disk space usage | ||
| - Clean up temporary files after processing | ||
|
|
||
| Good luck with your video analysis! |
There was a problem hiding this comment.
Done. Removed the "Important Notes" section including Performance Considerations, Error Handling, Best Practices, and Security Considerations.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| #### Keyframe Analysis: | ||
| 1. Extract all keyframes from the video: | ||
| ```bash | ||
| ffmpeg -i video.mp4 -vf "select='eq(pict_type,I)'" -fps_mode vfr -frame_pts 1 keyframe_%06d.jpg | ||
| ``` | ||
| 2. Count the number of keyframes extracted | ||
| 3. Report keyframe distribution (approximately every N seconds) | ||
| 4. List the first 10 keyframe filenames with their timestamps |
There was a problem hiding this comment.
Done. Removed the Keyframe Analysis section including I-frame extraction instructions.
| # High quality MP3 | ||
| ffmpeg -i video.mp4 -vn -acodec libmp3lame -ab 192k audio.mp3 | ||
|
|
||
| # Uncompressed WAV | ||
| ffmpeg -i video.mp4 -vn -acodec pcm_s16le audio.wav |
There was a problem hiding this comment.
Done. Simplified audio extraction to MP3 only, removed WAV format.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
This PR adds comprehensive FFmpeg support for GitHub Agentic Workflows, including installation guides, best practices, and an example workflow extracted from the GenAIScript ffmpeg implementation.
📁 Files Added
1. Shared Configuration:
ffmpeg.mdA focused 162-line guide providing:
/tmp/gh-aw/ffmpegfor caching intermediate resultsffmpegandffprobecommands2. Video Analyzer Workflow:
video-analyzer.mdA streamlined video analysis workflow that performs focused analysis including:
The workflow has been simplified to always perform full analysis (scenes + audio) without requiring users to choose between different analysis modes.
Usage:
gh workflow run video-analyzer.md \ --field video_url="https://example.com/video.mp4"🎯 Key Features from GenAIScript
Extracted and documented best practices from the GenAIScript implementation:
Scene Detection:
select='gt(scene,threshold)'showinfofilter for timestamp loggingAudio Extraction:
libmp3lamecodec at 192k bitratelibopuscodec with mono channel, 12k bitrate, and voip application mode for optimal speech-to-text processing (documented in shared guide)Automatic Installation:
${{ steps.setup-ffmpeg.outputs.version }}/tmp/gh-aw/ffmpegcreated for storing intermediate resultsTimeout Management:
Caching Strategy:
Bash Tools Configuration:
ffmpegandffprobecommands in frontmatter🔧 Usage in Custom Workflows
Import the shared guide in any workflow:
✅ Validation
make agent-finish)gh aw statusOriginal prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.