How can I Memento-ize videos, or play their scenes back-to-front?
August 21, 2014 11:25 AM Subscribe
Is there a video player that can either play a file's chapters in reverse order, or better yet, scan through a video to detect scenes (editors do this, right?), and then play them in reverse sequence?
Actually, mpv seems it doesn't like it when you try that syntax for the last chapter, so you actually need to specify the last (in this case, the first) chapter without a "duration" argument. Wrapper script to play a file in reverse chapter order with mpv would look something like this:
posted by tonycpsu at 12:55 PM on August 21, 2014#!/bin/bash CHAPCOUNT=$(( $(ffprobe -print_format compact -show_chapters "$1" \ 2>/dev/null | grep -c chapter) - 1 )) EDL="edl://" for (( chap=$CHAPCOUNT; chap >= 0; chap--)); do EDL+="$1,$chap" [ $chap != $CHAPCOUNT ] && EDL+=",1" EDL+=",timestamps=chapters;" done mpv "$EDL"
Best answer: This seems like a perfect task for FFmpeg.
FFmpeg can autodetect time indexes for scene changes whether or not the video has defined chapters. You can then use the program to split the video into parts based on those times and stitch the parts back together in reverse order. Sorry I don't know the exact commands offhand, and it is too time consuming for me to look them up for you! But the documentation is fairly straightforward and there are a ton of resources available. Even though it's a command line tool, I've found FFmpeg really easy to use.
posted by lesli212 at 3:32 PM on August 21, 2014 [1 favorite]
FFmpeg can autodetect time indexes for scene changes whether or not the video has defined chapters. You can then use the program to split the video into parts based on those times and stitch the parts back together in reverse order. Sorry I don't know the exact commands offhand, and it is too time consuming for me to look them up for you! But the documentation is fairly straightforward and there are a ton of resources available. Even though it's a command line tool, I've found FFmpeg really easy to use.
posted by lesli212 at 3:32 PM on August 21, 2014 [1 favorite]
« Older How do you compare profits to loss due to... | Where are some decent, non-magnet American urban... Newer »
This thread is closed to new comments.
If Unix-like, and for files that are already chapter-ized, you can make use of mpv's edl:// functionality. You'd need to script it a bit to get the number of chapters and then generate the proper edl syntax, which ends up looking something like this (for a movie with 5 chapters):
mpv 'edl://movie.mkv,4,1,timestamps=chapters;movie.mkv,3,1,timestamps=chapters;movie.mkv,2,1,timestamps=chapters;movie.mkv,1,1,timestamps=chapters;movie.mkv,0,1,timestamps=chapters'
Ugly, but functional.
posted by tonycpsu at 12:33 PM on August 21, 2014