I Measured 27 of My YouTube Shorts. Then a 75-Line Python Script Told Me Not to Trust Half of It
I run a small faceless science channel in Vietnamese. It posts a few Shorts a day, some I build myself (20-25 seconds), some made in FluxNote (38-54 seconds). After a week of posting I had 27 Shorts I could compare two days after each went live, and two questions I kept arguing with myself about: do

es length matter, and does the "best time to post" card in YouTube Studio actually mean anything for Shorts? The full write-up with charts is on my site. This post is the developer part: the CSV, the stdlib script that groups it, and the two checks that made me take back some of my own conclusions. One row per Short.
Length comes from the final MP4, views come from the YouTube Studio content list. slug,maker,post_date,post_time,length_s,views_2d headless-roach,hand,20/11,17:00,20.8,2796 ant-fall,hand,20/11,20:00,20.1,1419 breath-hold,hand,21/11,19:30,22.4,825 octopus-color,hand,21/11,21:00,22.3,1332 ... Getting length_s by hand is a waste of time, so I read it straight from the files with ffprobe: #!/usr/bin/env python3 """Print duration in seconds for each video file, as CSV. usage: python3 lengths.py *.mp4""" import json, subprocess, sys, os def duration(path): out = subprocess.run( ["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "json", path], capture_output=True, text=True, check=True).stdout return float(json.loads(out)["format"]["duration"]) print("file,length_s") for p in sys.argv[1:]: print(f"{os.path.basename(p)},{duration(p):.1f}") $ python3 lengths.py panda-bamboo.mp4 camel-hump.mp4 file,length_s panda-bamboo.mp4,41.7 camel-hump.mp4,41.1 Views I copied from Studio at about 09:50 local time, two days after each Short was posted.
Remember that detail. It comes back later. It does three things: Groups Shorts by length bucket and by posting slot, and prints median, min and max views. Median, not mean, because one viral Short (6,843 views on a panda video) would drag a mean around.
Works out how many hours each Short had actually been live when I read the number, and adds a views-per-hour column. Runs a permutation test on the gaps I cared about. Shuffle the group labels thousands of times and count how often a random split produces a median gap at least as big as the real one. If random splits do it 30% of the time, the "gap" is noise.
No numpy, no pandas. statistics.median and random.shuffle are enough at this size. #!/usr/bin/env python3 """Group YouTube Shorts views by length and posting slot, correct for hours live, and check whether a gap between two groups is bigger than chance. usage: python3 shorts_stats.py shorts.csv [--read 09:50] [--year 2026] CSV columns: slug,maker,post_date(DD/MM),post_time(HH:MM),length_s,views_2d """ import argparse, csv, random, statistics as st from datetime import datetime, timedelta def load(path, year, read_at): rows = [] with open(path, newline="") as f: for r in csv.DictReader(f): posted = datetime.strptime(f"{r['post_date']}/{year} {r['post_time']}", "%d/%m/%Y %H:%M") h, m = map(int, read_at.split(":")) read = (posted + timedelta(days=2)).replace(hour=h, minute=m) r["hours_live"] = (read - posted).total_seconds() / 3600 r["length_s"] = float(r["length_s"]) r["views_2d"] = int(r["views_2d"]) r["per_hour"] = r["views_2d"] / r["hours_live"] rows.append(r) return rows def length_bucket(r): if r["maker"] == "hand": return "hand 20-25s" s = r["length_s"] return "flux <=42s" if s <= 42 else "flux 42-47s" if s <= 47 else "flux >47s" def slot(r): t = r["post_time"] return {"17:00": "17:00-18:00", "18:00": "17:00-18:00", "19:30": "19:30-20:00", "20:00": "19:30-20:00"}.get(t, t) def table(rows, key, title): groups = {} for r in rows: groups.setdefault(key(r), []).append(r) print(f"\n{title:<14}{'n':>3}{'median':>9}{'min':>7}{'max':>7}{'hrs':>6}{'views/h':>9}") for k in sorted(groups): g = groups[k] v = [r["views_2d"] for r in g] print(f"{k:<14}{len(g):>3}{st.median(v):>9,.0f}{min(v):>7,}{max(v):>7,}" f"{st.mean(r['hours_live'] for r in g):>6.1f}{st.median(r['per_hour'] for r in g):>9.1f}") return groups def perm_test(a, b, n=20000, seed=1): """Share of random relabelings whose median gap is at least as big as the real one.""" real = abs(st.median(a) - st.median(b)) pool, k, rng, hits = a + b, len(a), random.Random(seed), 0 for _ in range(n): rng.shuffle(pool) if abs(st.median(pool[:k]) - st.median(pool[k:])) >= real: hits += 1 return real, hits / n def main(): ap = argparse.ArgumentParser() ap.add_argument("csv") ap.add_argument("--read", default="09:50", help="clock time you read the views") ap.add_argument("--year", type=int, default=datetime.now().year) a = ap.parse_args() rows = load(a.csv, a.year, a.read) lg = table(rows, length_bucket, "length") sg = table(rows, slot, "slot") for label, x, y, field in [ ("flux <=42s vs flux >42s", lg["flux <=42s"], lg["flux 42-47s"] + lg["flux >47s"], "views_2d"), ("12:00 vs 21:00 (raw)", sg["12:00"], sg["21:00"], "views_2d"), ("12:00 vs 21:00 (per hour)", sg["12:00"], sg["21:00"], "per_hour"), ]: gap, p = perm_test([r[field] for r in x], [r[field] for r in y]) print(f"\n{label}: median gap {gap:,.1f}, chance of a gap this big by luck ~{p:.0%}") if __name__ == "__main__": main() Python 3.8+ and nothing to install.
$ python3 shorts_stats.py shorts.csv --year 2026 length n median min max hrs views/h flux 42-47s 6 1,178 643 2,258 38.3 31.2 flux <=42s 7 1,938 803 6,843 38.8 50.6 flux >47s 3 831 787 1,913 43.3 20.5 hand 20-25s 11 1,614 825 2,796 39.3 42.1 slot n median min max hrs views/h 12:00 5 1,958 831 2,742 45.8 42.7 17:00-18:00 5 1,805 643 6,843 40.0 45.3 19:30-20:00 8 1,560 787 2,258 38.3 40.7 21:00 7 1,052 803 1,861 36.8 28.6 22:30 2 1,352 908 1,795 35.3 38.2 flux <=42s vs flux >42s: median gap 1,089.0, chance of a gap this big by luck ~7% 12:00 vs 21:00 (raw): median gap 906.0, chance of a gap this big by luck ~11% 12:00 vs 21:00 (per hour): median gap 14.2, chance of a gap this big by luck ~31% Length. Among the FluxNote Shorts, the ones at 42 seconds or less had a median of 1,938 views. The ones over 47 seconds had 831. The permutation test says a gap that size shows up by luck about 7% of the time.
Not proof, but not nothing. The catch is that the short group was mostly animal topics (panda, camel, woodpecker, honeybee), which are my strongest topics anyway. Length and topic are tangled together, and the script can't untangle that. What I changed: I now write FluxNote scripts to land around 40-45 seconds instead of close to a minute, and I'll rerun this on the next 20.
Also worth saying: my 20-second hand-built Shorts were not punished for being short. A 20.8-second one about a headless cockroach did 2,796. Posting time. This is where the script changed my mind.
On raw views, 12:00 looked like the clear winner (1,958) and 21:00 the clear loser (1,052), even though Studio says my viewers are most active from 18:00 to 21:00. Then look at the hrs column. I read every number at 09:50. A Short posted at noon had been live almost 46 hours by then.
One posted at 21:00 had about 37. That's roughly 25% more time on the clock for noon, before topic or algorithm even come into it. Divide by hours live and the 12:00 vs 21:00 gap shrinks from 906 views to 14 views per hour, and the chance of seeing it by luck goes from 11% to 31%. So "noon is the best slot" was mostly my measuring habit.
21:00 still trails on both measures, so I've stopped treating it as prime time, but I'm not moving everything to noon on the strength of five videos. Read views at a fixed age, not a fixed clock time. "48 hours after publish" is fair to every slot. "Every morning at 9" is not.
If you can't, at least log the read time and use --read so the per-hour column is honest. Keep the CSV boring. One row per Short, the scheduled time (not when you clicked upload), length from ffprobe. Don't drop outliers just because they make a chart ugly.
My panda Short is in there. Don't trust a gap until you've shuffled it. The permutation test is ten lines and it will save you from rebuilding your schedule around noise. With groups of five, almost anything can happen by luck.
Log topic too. The biggest thing I learned isn't in any column: topic swamped both length and time. Next round I'm adding a topic column (animal, body, physics) so I can at least compare within a category. Shorts can be up to three minutes now (for uploads since October 15, 2024, per YouTube Help), so "keep it under 60" is no longer a platform rule.
It's a choice you can test. The charts, the full table of all 27 Shorts and the rest of the reasoning are on the original post: YouTube Shorts length and upload time: what 27 of our Shorts show. If you've done something similar on your own channel, I'd like to know if your evening slot actually wins once you correct for hours live. Mine didn't.
Key Takeaways
- •The full write-up with charts is on my site.
- •This story was reported by Dev.to, covering developments in the dev space.
- •AI advancements continue to reshape industries — read the full article on Dev.to for complete coverage.
📖 Continue reading the full article:
Read Full Article on Dev.to →


