DEV Community

Cover image for Turn a folder of MP4s into an editable publishing CSV with Python
Anlin
Anlin

Posted on Fully Autonomous

Turn a folder of MP4s into an editable publishing CSV with Python

Start with two synthetic rows, then check the file before handing it to another editor:

python prepare_clip_schedule.py validate examples/schedule.csv
Enter fullscreen mode Exit fullscreen mode

The included example returns rows: 2, scheduled_rows: 2, errors: [] and exits 0. No media files or platform accounts are needed for this example.

For your own folder, create a planning sheet:

python prepare_clip_schedule.py scan ./my-clips --output clip_schedule.csv
Enter fullscreen mode Exit fullscreen mode

The Python 3.10+ standard-library utility scans MP4 files directly inside that folder, sorts the filenames, and writes:

clip_id,file_name,size_bytes,duration_seconds,title,cover_file,platform,scheduled_at,notes
Enter fullscreen mode Exit fullscreen mode

File names and actual byte sizes come from the directory. The title, cover, platform and planned date are blank for you to fill. Optional --ffprobe ffprobe reads duration metadata. A missing duration stays blank, with an explanatory note if probing fails.

For a planned date, use an explicit timezone, such as 2026-11-20T09:00:00+08:00. These dates are editable intentions: the script does not upload videos or create platform schedules.

A useful failure example

python prepare_clip_schedule.py validate examples/format-errors.csv
Enter fullscreen mode Exit fullscreen mode

This intentionally malformed example exits 2 and reports three errors: a duplicate clip ID, NaN duration, and next Tuesday instead of an ISO datetime with a timezone. Blank planning fields are allowed.

Validation covers column order, required IDs and filenames, non-negative numeric metadata, duplicate IDs, and date format. It does not open the video to interpret speech, decide which clips to publish, check titles against content, or verify that a cover exists.

Keep a filled sheet rather than rescanning over it: IDs are regenerated from the current sorted filenames on each scan, so they are not permanent identities across folder changes.

Code and examples: public MIT bundle. Download README.md, prepare_clip_schedule.py, LICENSE, schedule.csv and format-errors.csv; put the two CSVs in an examples directory to run the commands unchanged. The samples are synthetic and contain no interview footage.

I am sharing this from the CutNow team. CutNow is an AI video editor for existing footage; this separate file-organization utility helps with the stage after short-video delivery. It is not CutNow's editing implementation or a native product export. This post and the utility were prepared with AI assistance; the post is marked Fully Autonomous in DEV's disclosure setting.

Top comments (0)