You are not logged in.
I want to do some basic video editing without large graphical suites like Kdenlive.
Also because my most powerful computer at home is now headless, it would be nice if I can somehow still use it for video editing.
Let's suppose the following simple case: I need to cut and re-encode a specific portion of the video. Given the starting and ending timestamp, this can be easily accomplished with ffmpeg. But how to get the start and end points in a scriptable way? Currently I have this workflow in mind: I playback the video with mpv, pause at the positions where I want to cut, bind a keyboard shortcut which will simply write the current timestamp to a text file, then run ffmpeg with the timestamps from that file.
However, I can't figure out how to use mpv in such way. Any suggestions? I am sure this has been done by many people, just don't know where to fine the relevant information.
Well, in fact, it doesn't have to be mpv and ffmpeg. Any solutions which will solve this problem are appreciated.
Offline
Maybe using one of the user scripts, like this one: https://github.com/nimatrueway/mpv-bookmark-lua-script to create the timestamp file?
Offline
ffplay video.mpg 2> /tmp/logThen pause whenever you want, and get the timestamp:
tr '\r' '\n' < /tmp/log | awk 'END { print $1; }'"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
mplayer can also do this natively with
mplayer -edloutThe manual has more info.
Offline
then run ffmpeg with the timestamps from that file.
You are going to have a hard time with that. The ending time stamp isn't what ffmpeg wants, but rather the duration from where you started.
If you want from time stamp 00:02:36 to 00:05:17 in a video, then what you want is:
ffmpeg -ss 00:02:36 -t 00:02:41This little bash script will spit out the start of a ffmpeg line, after you enter the start and stop times.
https://bbs.archlinux.org/viewtopic.php … 7#p1765337
You can also start/stop on frame number if that's better for your script.
This will show you frame numbers of video while it's playing.
ffplay file.mp4 \
-vf "drawtext=fontfile=Arial.ttf: text=%{n}: \
x=(w-tw)/2: y=h-(2*lh): fontcolor=white: \
fontsize=100: box=1: boxcolor=0x00000099"Press the space bar to pause, get the frame number.
30 fps video, frame_num / 30 = time stamp.
Offline
You are going to have a hard time with that. The ending time stamp isn't what ffmpeg wants, but rather the duration from where you started.
Or use the -to option instead.
Offline