Finalize Python B-Roll Automation Workflow
Budget: $30 – $250 USD
I already have a set of Python scripts that use ffmpeg, OpenAI Whisper, and a few helper libraries to scan a long-form video, pick out suitable moments for b-roll, and cut them into individual clips. ChatGPT helped me scaffold everything, but stitching the pieces together, handling edge-cases, and getting the workflow to run end-to-end has proven trickier than expected.
The core objective is simple: extract clean b-roll clips automatically. The transcription, timestamp collection, and rough cut logic are in place and ready to run; they just need solid engineering, refactoring, and a layer of reliability so I can drop in any source video and receive neatly named MP4 snippets without manual intervention.
Here’s what I’m looking for next:
• tighten up or rewrite any fragile sections of the existing code
• make sure Whisper calls are handled efficiently (batching, rate-limits, retries)
• ensure ffmpeg commands are sequenced correctly and work cross-platform
• add clear logging plus a basic README so others can replicate the setup
If you’ve completed similar automation around video clipping, speech-to-text, or ffmpeg pipelines, please share that past work when you reply. A quick screen-grab, GitHub link, or short demo clip showing your previous results will help me see your approach at a glance.
I can provide the repository, test footage, and a step-by-step outline of the current flow as soon as we start. Let’s get this script polished so I can hit “run” and watch the b-roll appear.
_________________________________________
Automated Workflow for Extracting B‑Roll from a Final Fantasy Tactics Longplay
Overview
This workflow automates the process of converting a Final Fantasy Tactics longplay video (the YouTube link you provided) into separate B‑roll clips. It uses open‑source tools (yt‑dlp, Whisper, Python, RapidFuzz and FFmpeg) and leverages the provided FFT narrative script to align scenes accurately.
Prerequisites
Python 3.10+ with pip
Tools: yt‑dlp, ffmpeg, openai-whisper, rapidfuzz, python-docx, pysrt, pandas
Documents: FFT Full Script.docx for dialogue matching and other files (Comprehensive Report, Character Compendium, Story Missions, Geography & Timeline) for contextual information
Step 1 – Download the longplay video
To work offline, first download the YouTube video using yt‑dlp. The tool can download any single video by just passing the URL
ostechnix.com
. You can also specify the output filename or directory using the -o flag
ostechnix.com
. For example:
# Install yt‑dlp (if not already)
pip install -U yt-dlp
# Download the video and save it as fft_longplay.mp4
yt-dlp -o "fft_longplay.mp4" "https://www.youtube.com/watch?v=8AIsju_KT-E"
This fetches the full longplay video at its highest available quality. Downloading copyrighted material should only be done if you have rights to the content.
Step 2 – Transcribe the longplay using Whisper
OpenAI’s Whisper provides a versatile CLI for speech transcription. It lets you pick model sizes (tiny, base, small, medium, large etc.) using the --model flag
zread.ai
. For long videos we recommend the medium model, which balances accuracy and speed
zread.ai
. You can improve accuracy by explicitly setting the language (--language English)
zread.ai
and telling Whisper to transcribe rather than translate (--task transcribe)
zread.ai
. Whisper supports multiple output formats (txt, vtt, srt, tsv, json or all) using the --output_format flag
zread.ai
.
Example:
# Install Whisper and dependencies
pip install git+https://github.com/openai/whisper.git
# Transcribe the longplay to SRT and TXT formats
whisper "fft_longplay.mp4" \
--model medium \
--task transcribe \
--language English \
--output_format all \
--output_dir transcripts
This command generates fft_longplay.srt, fft_longplay.txt, fft_longplay.vtt, etc., in the transcripts/ folder. Whisper runs locally to preserve privacy
guides.libraries.emory.edu
.
Why we specify options
Model choice – larger models improve accuracy but need more memory
zread.ai
. medium offers good accuracy and manageable requirements.
Language – explicitly providing the language helps Whisper avoid mis‑detecting the first 30 seconds
zread.ai
.
Task – transcribe preserves the original language, while translate converts non‑English speech to English
zread.ai
.
Output format – requesting srt or txt makes it easy to parse timestamps in later steps
zread.ai
.
Step 3 – Prepare the narrative script
Use the provided FFT Full Script.docx for dialogue references. Convert it to a plain‑text file so you can parse it in Python. A simple approach uses python-docx:
from docx import Document
def extract_docx_lines(docx_path):
doc = Document(docx_path)
return [p.text.strip() for p in doc.paragraphs if p.text.strip()]
lines = extract_docx_lines("FFT Full Script.docx")
with open("fft_script.txt", "w", encoding="utf-8") as f:
f.write("\n".join(lines))
This produces a fft_script.txt file with one line per script paragraph.
Step 4 – Align script lines with the transcript
The goal here is to estimate when each script line occurs in the video. A practical technique is fuzzy string matching: for each script line, search through the SRT transcript for the most similar sequence of subtitles. RapidFuzz’s token_set_ratio() function compares word sets and is robust to paraphrasing.
A typical workflow:
Read the .srt file using pysrt and build a list of tuples (start_time, end_time, subtitle_text).
For each script line, evaluate a sliding window of two or three consecutive subtitles.
Compute the token set ratio between the script line and each candidate window.
Pick the window with the highest similarity above a chosen threshold (e.g., 60 %). Record the line, the matching subtitle text, and start/end times.
Save the results to a CSV (e.g., scene_matches.csv).
The broll_extractor_toolkit.py file supplied earlier contains a match_scenes() function that implements these steps. You can call:
from broll_extractor_toolkit import match_scenes
matches_df = match_scenes(
script_path="fft_script.txt",
srt_path="transcripts/fft_longplay.srt",
similarity_threshold=60,
window=2,
)
matches_df.to_csv("scene_matches.csv", index=False)
After running this, manually spot‑check the CSV to correct misaligned lines. Scenes without sufficient similarity will have missing timestamps and should be ignored.
Step 5 – Generate FFmpeg cut commands
Once you know the start and end times for each scene, you can create one‑liner commands to extract those segments. FFmpeg’s -ss and -t options specify the start time and duration respectively
mux.com
, and -c copy copies audio and video without re‑encoding for speed
mux.com
. You can also use -to instead of -t to specify an absolute end time
mux.com
.
Example single clip command:
ffmpeg -i fft_longplay.mp4 -ss 00:10:45 -to 00:12:22 -c copy miluda_final_stand.mp4
This extracts the clip from 10:45 to 12:22 of the source video. To build commands programmatically, loop through the rows in scene_matches.csv and format the timestamps. The generate_ffmpeg_commands() function in broll_extractor_toolkit.py does this for you:
from broll_extractor_toolkit import generate_ffmpeg_commands
commands = generate_ffmpeg_commands(
timestamps="scene_matches.csv",
video_file="fft_longplay.mp4",
output_dir="clips",
label_column="script_line",
)
with open("cut_commands.sh", "w") as f:
f.write("\n".join(commands))
FFmpeg clipping considerations
Use the HH:MM:SS.mmm time format
mux.com
.
When copying streams (-c copy), FFmpeg will cut at the nearest keyframe, so the actual cut may be slightly off
mux.com
.
For frame‑accurate cuts, re‑encode the video by placing -ss before -i and dropping -c copy
mux.com
.
Always verify the output video to ensure it contains the intended clip
mux.com
.
Optional Step 6 – Stylize clips with RunwayML
After trimming, you may want to stylize the B‑roll clips to fit the Ivalice Insider aesthetic. Tools like RunwayML offer models such as “Green Screen,” “Motion Brush,” or “Stylization.” Upload each clip, apply the desired effect, and export in the target aspect ratio (YouTube Shorts or widescreen).
Step 7 – Integrate context from the provided documents (optional)
To enrich your content, cross‑reference the scene matches with information from:
FFT Geography & Timeline – to contextualize scenes in chronological order.
FFT Story Missions – to map each clip to its mission chapter.
FFT Character Compendium – to identify character appearances in each clip.
Final Fantasy Tactics Comprehensive Report – for lore details and analysis.
Use these documents to write narrations or captions for each B‑roll segment, ensuring consistency with the Ivalice Insider style guide.
Conclusion
This workflow automates B‑roll generation for a long Final Fantasy Tactics playthrough. It leverages open‑source tools for downloading, transcribing, aligning script lines, cutting clips, and optional stylization. By combining transcript‑driven timestamps with the game’s narrative script, you can efficiently produce high‑quality B‑roll that aligns with the story and characters of Ivalice.
The core objective is simple: extract clean b-roll clips automatically. The transcription, timestamp collection, and rough cut logic are in place and ready to run; they just need solid engineering, refactoring, and a layer of reliability so I can drop in any source video and receive neatly named MP4 snippets without manual intervention.
Here’s what I’m looking for next:
• tighten up or rewrite any fragile sections of the existing code
• make sure Whisper calls are handled efficiently (batching, rate-limits, retries)
• ensure ffmpeg commands are sequenced correctly and work cross-platform
• add clear logging plus a basic README so others can replicate the setup
If you’ve completed similar automation around video clipping, speech-to-text, or ffmpeg pipelines, please share that past work when you reply. A quick screen-grab, GitHub link, or short demo clip showing your previous results will help me see your approach at a glance.
I can provide the repository, test footage, and a step-by-step outline of the current flow as soon as we start. Let’s get this script polished so I can hit “run” and watch the b-roll appear.
_________________________________________
Automated Workflow for Extracting B‑Roll from a Final Fantasy Tactics Longplay
Overview
This workflow automates the process of converting a Final Fantasy Tactics longplay video (the YouTube link you provided) into separate B‑roll clips. It uses open‑source tools (yt‑dlp, Whisper, Python, RapidFuzz and FFmpeg) and leverages the provided FFT narrative script to align scenes accurately.
Prerequisites
Python 3.10+ with pip
Tools: yt‑dlp, ffmpeg, openai-whisper, rapidfuzz, python-docx, pysrt, pandas
Documents: FFT Full Script.docx for dialogue matching and other files (Comprehensive Report, Character Compendium, Story Missions, Geography & Timeline) for contextual information
Step 1 – Download the longplay video
To work offline, first download the YouTube video using yt‑dlp. The tool can download any single video by just passing the URL
ostechnix.com
. You can also specify the output filename or directory using the -o flag
ostechnix.com
. For example:
# Install yt‑dlp (if not already)
pip install -U yt-dlp
# Download the video and save it as fft_longplay.mp4
yt-dlp -o "fft_longplay.mp4" "https://www.youtube.com/watch?v=8AIsju_KT-E"
This fetches the full longplay video at its highest available quality. Downloading copyrighted material should only be done if you have rights to the content.
Step 2 – Transcribe the longplay using Whisper
OpenAI’s Whisper provides a versatile CLI for speech transcription. It lets you pick model sizes (tiny, base, small, medium, large etc.) using the --model flag
zread.ai
. For long videos we recommend the medium model, which balances accuracy and speed
zread.ai
. You can improve accuracy by explicitly setting the language (--language English)
zread.ai
and telling Whisper to transcribe rather than translate (--task transcribe)
zread.ai
. Whisper supports multiple output formats (txt, vtt, srt, tsv, json or all) using the --output_format flag
zread.ai
.
Example:
# Install Whisper and dependencies
pip install git+https://github.com/openai/whisper.git
# Transcribe the longplay to SRT and TXT formats
whisper "fft_longplay.mp4" \
--model medium \
--task transcribe \
--language English \
--output_format all \
--output_dir transcripts
This command generates fft_longplay.srt, fft_longplay.txt, fft_longplay.vtt, etc., in the transcripts/ folder. Whisper runs locally to preserve privacy
guides.libraries.emory.edu
.
Why we specify options
Model choice – larger models improve accuracy but need more memory
zread.ai
. medium offers good accuracy and manageable requirements.
Language – explicitly providing the language helps Whisper avoid mis‑detecting the first 30 seconds
zread.ai
.
Task – transcribe preserves the original language, while translate converts non‑English speech to English
zread.ai
.
Output format – requesting srt or txt makes it easy to parse timestamps in later steps
zread.ai
.
Step 3 – Prepare the narrative script
Use the provided FFT Full Script.docx for dialogue references. Convert it to a plain‑text file so you can parse it in Python. A simple approach uses python-docx:
from docx import Document
def extract_docx_lines(docx_path):
doc = Document(docx_path)
return [p.text.strip() for p in doc.paragraphs if p.text.strip()]
lines = extract_docx_lines("FFT Full Script.docx")
with open("fft_script.txt", "w", encoding="utf-8") as f:
f.write("\n".join(lines))
This produces a fft_script.txt file with one line per script paragraph.
Step 4 – Align script lines with the transcript
The goal here is to estimate when each script line occurs in the video. A practical technique is fuzzy string matching: for each script line, search through the SRT transcript for the most similar sequence of subtitles. RapidFuzz’s token_set_ratio() function compares word sets and is robust to paraphrasing.
A typical workflow:
Read the .srt file using pysrt and build a list of tuples (start_time, end_time, subtitle_text).
For each script line, evaluate a sliding window of two or three consecutive subtitles.
Compute the token set ratio between the script line and each candidate window.
Pick the window with the highest similarity above a chosen threshold (e.g., 60 %). Record the line, the matching subtitle text, and start/end times.
Save the results to a CSV (e.g., scene_matches.csv).
The broll_extractor_toolkit.py file supplied earlier contains a match_scenes() function that implements these steps. You can call:
from broll_extractor_toolkit import match_scenes
matches_df = match_scenes(
script_path="fft_script.txt",
srt_path="transcripts/fft_longplay.srt",
similarity_threshold=60,
window=2,
)
matches_df.to_csv("scene_matches.csv", index=False)
After running this, manually spot‑check the CSV to correct misaligned lines. Scenes without sufficient similarity will have missing timestamps and should be ignored.
Step 5 – Generate FFmpeg cut commands
Once you know the start and end times for each scene, you can create one‑liner commands to extract those segments. FFmpeg’s -ss and -t options specify the start time and duration respectively
mux.com
, and -c copy copies audio and video without re‑encoding for speed
mux.com
. You can also use -to instead of -t to specify an absolute end time
mux.com
.
Example single clip command:
ffmpeg -i fft_longplay.mp4 -ss 00:10:45 -to 00:12:22 -c copy miluda_final_stand.mp4
This extracts the clip from 10:45 to 12:22 of the source video. To build commands programmatically, loop through the rows in scene_matches.csv and format the timestamps. The generate_ffmpeg_commands() function in broll_extractor_toolkit.py does this for you:
from broll_extractor_toolkit import generate_ffmpeg_commands
commands = generate_ffmpeg_commands(
timestamps="scene_matches.csv",
video_file="fft_longplay.mp4",
output_dir="clips",
label_column="script_line",
)
with open("cut_commands.sh", "w") as f:
f.write("\n".join(commands))
FFmpeg clipping considerations
Use the HH:MM:SS.mmm time format
mux.com
.
When copying streams (-c copy), FFmpeg will cut at the nearest keyframe, so the actual cut may be slightly off
mux.com
.
For frame‑accurate cuts, re‑encode the video by placing -ss before -i and dropping -c copy
mux.com
.
Always verify the output video to ensure it contains the intended clip
mux.com
.
Optional Step 6 – Stylize clips with RunwayML
After trimming, you may want to stylize the B‑roll clips to fit the Ivalice Insider aesthetic. Tools like RunwayML offer models such as “Green Screen,” “Motion Brush,” or “Stylization.” Upload each clip, apply the desired effect, and export in the target aspect ratio (YouTube Shorts or widescreen).
Step 7 – Integrate context from the provided documents (optional)
To enrich your content, cross‑reference the scene matches with information from:
FFT Geography & Timeline – to contextualize scenes in chronological order.
FFT Story Missions – to map each clip to its mission chapter.
FFT Character Compendium – to identify character appearances in each clip.
Final Fantasy Tactics Comprehensive Report – for lore details and analysis.
Use these documents to write narrations or captions for each B‑roll segment, ensuring consistency with the Ivalice Insider style guide.
Conclusion
This workflow automates B‑roll generation for a long Final Fantasy Tactics playthrough. It leverages open‑source tools for downloading, transcribing, aligning script lines, cutting clips, and optional stylization. By combining transcript‑driven timestamps with the game’s narrative script, you can efficiently produce high‑quality B‑roll that aligns with the story and characters of Ivalice.
Related categories:
Python
Software Architecture
Shell Script
Mathematics
Video Editing
Scripting
Video Processing
Automation