Day 5 of 1060 minShell Walker
Day 5: Deepfake Video Analysis: Streams, Frames and Clues
Taught by Mr Elite Updated
By the end of today you can
- Read container, stream and frame-rate details from a video with ffprobe
- Extract frames from a clip with ffmpeg at a chosen rate and keep them organised
- Look for face boundary, blinking, lighting and compression clues and rate each one
- Explain why re-encoding and frame-rate oddities are leads and not proof
Warm-up
Answer from memory first, then tap to check. Recalling yesterday is what makes it stick.
On Day 4 we said to preserve first, observe second, judge last. What does preserve mean in practice?
Hash the original file and work only on copies, so you can show the evidence was not changed.
Why did we rate each signal separately and consider an innocent explanation for each?
A single oddity can have an ordinary cause, so each signal gets its own strength rating and agreement between independent signals matters most.
Someone sends you a 20 second clip of a manager apparently approving an urgent payment. It looks fine at a glance. Your Day 4 checklist worked for still images, but a video is thousands of images plus sound, wrapped in a container, and any of those parts may tell a different story.
Today we break the clip apart. You will read what the file says about itself, pull out frames you can study one at a time, and learn which visual clues are worth writing down. I will also be honest about which clues are weak, because the weak ones catch out experienced analysts most often.
Video is a container holding streams
A video file such as .mp4 is a container. Think of it as a box. Inside are separate streams: usually one video stream, one audio stream, and sometimes data tracks. Each stream is compressed with a codec. Knowing what is in the box and how it was packed gives you leads before you watch a single frame.
- Container
- The file format that holds the streams together, for example MP4 or MKV.
- Codec
- The method used to compress a stream, for example H.264 for video or AAC for audio.
- Frame rate
- How many frames are shown per second, written as fps.
- Re-encoding
- Decompressing a video and compressing it again, which loses a little detail each time.
- Keyframe
- A frame stored in full. The frames between keyframes store only changes.
Why does this matter for deepfakes? Face-swap tools usually work on decoded frames, then the result is encoded again. So a manipulated video has often been through at least one extra encode. That leaves traces, though ordinary sharing apps leave the same traces. Keep that in mind all day.
Watch me do it: ffprobe and frame extraction
I will use a clip called suspect.mp4. Use any short clip you have, ideally one you filmed yourself on a phone. Everything runs on your own machine against your own copy. Following Day 1 habits, we hash first.
mkdir -p ~/case05/frames && cd ~/case05
cp ~/Downloads/suspect.mp4 .
sha256sum suspect.mp4 | tee hash.txtffprobe -hide_banner -show_format -show_streams suspect.mp4 2>&1 | lessffprobe -v error -select_streams v:0 -show_entries stream=codec_name,width,height,r_frame_rate,avg_frame_rate,nb_frames,duration -of default=noprint_wrappers=1 suspect.mp4ffmpeg -i suspect.mp4 -vf fps=2 frames/frame_%04d.pngQuick check
Why do we extract frames as PNG rather than JPEG?
JPEG would add fresh compression artefacts that could be mistaken for signs of manipulation.
What to look for in the frames
Now study the frames. Zoom in to 200 percent on the face and move through consecutive frames. Look at one area at a time rather than the whole picture.
Quick check
A face looks slightly blurrier than the background in one frame only. How should you rate it?
One frame is a single observation. It becomes more meaningful only if it repeats and agrees with other signals.
Frame-rate and re-encoding clues
Back to ffprobe. Several details in its output hint at how a file was made. The encoder tag, the creation time, the number of streams and the frame rate all tell part of a story. Compare what the file claims with what you were told. If someone says it was filmed live on a phone yesterday, a screen-recorder encoder tag and a variable frame rate do not fit.
ffprobe -v error -show_entries format_tags=encoder,creation_time:stream=codec_name,avg_frame_rate -of default=noprint_wrappers=1 suspect.mp4You can also look at frame types. A video normally repeats a pattern of keyframes. A break in that pattern can mean a splice or a re-encode. This command lists the type of each frame for the first video stream.
ffprobe -v error -select_streams v:0 -show_entries frame=pict_type -of csv=p=0 suspect.mp4 | head -60 | tr '\n' ' 'You should see a regular rhythm, such as an I followed by a repeating run of P and B. Irregular spacing is a lead only. Editors, social platforms and messaging apps all re-encode, so the honest statement is that the file has been processed, not that the face is fake.
Your practice: compare frames with ffprobe
No lab is set for today, so this runs on your own machine with a clip you filmed. Film 10 to 15 seconds of yourself talking, turning your head and blinking. Then make a second copy by re-encoding it, which simulates what a sharing app does.
ffmpeg -i suspect.mp4 -vf scale=640:-2 -r 24 -crf 32 reencoded.mp4Run the same ffprobe and frame extraction on both files, using separate folders. Compare resolution, frame rate, bitrate and how the face edge looks. You will see how much a plain re-encode changes, and that gives you an honest baseline for later cases.
If it did not work
Working on the original file instead of a copy
Hash first, copy, and run every command against the copy. Re-run sha256sum on the original at the end to show it is unchanged.
Extracting every frame and drowning in images
Start with fps=1 or fps=2, or a short time window. Extract more densely only around moments that look odd.
Treating a variable frame rate or odd encoder tag as proof of a deepfake
Screen recorders, editors and chat apps cause the same traces. Record it as a lead and look for an independent signal.
Judging from a single blurry frame
Check neighbouring frames. A real signal repeats across time and across more than one area.
Recap
- A video is a container holding separate streams, and each stream has its own codec and details
- ffprobe tells you what the file claims, ffmpeg lets you study what it shows
- Extract frames as PNG to avoid adding new compression artefacts
- Check face edges, eyes, lighting, teeth and texture one at a time and across several frames
- Re-encoding and frame-rate oddities show processing, not manipulation
- Rate every signal separately and look for agreement between independent signals
Cheat sheet
ffprobe -show_format -show_streams file- Full container and stream details
r_frame_rate vs avg_frame_rate- A large gap suggests variable frame rate
ffmpeg -i file -vf fps=2 frames/f_%04d.png- Save two lossless frames per second
-ss 00:00:05 -t 3- Start at 5 seconds and take 3 seconds
pict_type I/P/B- Frame types; I is a keyframe
sha256sum file- Record integrity hash before analysis
Before the next day
Mission: Clip versus frames comparison note
Using a short clip you filmed yourself, extract frames, compare them with ffprobe output and write down every inconsistency you can find, or state clearly that you found none. Doing this on a known genuine clip teaches you what normal looks like, which is the baseline every later judgement depends on.
About 35 min
You are done when: A notes05.md file with the hash, ffprobe values for both clips, at least five frames reviewed, and each finding rated with an innocent explanation.
Want more? Use ffprobe frame types on both clips and describe how the keyframe pattern changed after re-encoding.
Quiz
4 questions. Your score is saved with your progress.
1. What does a video container hold?
The container packages several streams together, and each can be examined on its own.
2. ffprobe shows avg_frame_rate far from r_frame_rate. What is the most defensible conclusion?
Variable frame rate is a processing clue with many innocent causes.
3. Why is agreement between signals more valuable than one oddity?
Each signal alone has innocent explanations, but several independent ones together raise confidence.
4. Which statement about a re-encoded file is correct?
Re-encoding is common in ordinary sharing, so it only tells you the file is not the original capture.
Finish the day
Mark the day complete to save your progress.
Next: Day 6 moves to the sound track. You will pull audio out of a clip and compare genuine and synthetic speech with spectrograms, using the same habit of rating each signal separately.
Your notes
Private to this device. Write what you want to remember from today.