it wasn’t showing up for me before but is now. thank you!
yep, thanks! edited to make it more wiki-like!
I’ve been using ffmpeg to do some motion interpolation glitchy effects, which works best if you try and slow down a very short video (two frames in my case) to be verrrrry long.
Here’s a breakdown of the settings https://www.hellocatfood.com/motion-interpolation-for-glitch-aesthetics-using-ffmpeg-part-0/
ffmpeg -i input -filter:v "setpts=62.5*PTS,minterpolate='fps=25:mb_size=16:search_param=400:vsbmc=0:scd=none:mc_mode=aobmc:me_mode=bilat:me=umh'" output.mp4
Not the function’s intended use but may be useful for someone!
That’s a cool effect, hadn’t seen that use case before. Nice
haven’t tried this but looks wow
wooo displacement maps! found via Crash-Stop: RED plus FFmpeg displacement.
example (the main source abstract.mkv and the output displaced.mkv are shown below):
ffmpeg -i abstract.mkv -i people.mkv -lavfi ‘[1]split[y],[0][y]displace’ displaced.mkv
in a live setting, one could set capture cards as inputs and route the ffmpeg output to ffplay…
ffmpeg -i /dev/video0 -i /dev/video2 -lavfi ‘[1]split[y],[0][y]displace’ -f rawvideo -pix_fmt yuv420p - | ffplay -f rawvideo -pix_fmt yuv420p -s 720x576 -
Hey, this is a cool introduction and script collection for creative effects with ffmpeg.
A (n internet) friend of mine is doing an online ffmpeg class: Video Art with FFMPEG starting Saturday May 22nd | BustBright - Machine Learning Art
He usually teaches ML classes, so this is not his first rodeo. There is a cheaper audit option open as well.
(admin note: this post and the 2 following ones have been moved here from this thread)
We now have an ffmpeg thread which works on Mac, Linux and probably PC (at least on Windows Subsystem for Linux but possibly also in the Cmd prompt?).
To make a short clip, you can trim a video from a given start time mm:ss to an end time mm2:ss2. You can also convert between formats simply by changing the output file extension.
ffmpeg -ss {{mm:ss}} -to {{mm2:ss2}} -i {{input-video.mp4}} -codec copy {{output.mp4}}
Yea, this works on Windows as well. To trim a video down, I use ffmpeg -i INPUT -c:v copy -ss 00:00:10 -to 00:01:00 OUTPUT for example. If you want to trim a duration instead of to a specific time, use -t instead of -to. Replace 00:00:00 with duration of seconds. It would look like this… ffmpeg -i INPUT -c:v copy -ss 00:00:10 -t 50 OUTPUT. Those each accomplish the same task.
Also, for looping clips together, I create a text file with the video file listed however many times I want it repeated like this…
file ‘video1.mp4’
file ‘video1.mp4’
file ‘video1.mp4’
I usually save it as list.txt or something similar, then run… ffmpeg -f concat -i list.txt -c copy output.mp4
Hopefully that helps.
For quite some years I have been using this script to extract short clips (usually 1 second) out of a video. A script to perform a random cut on a video · GitHub
It takes an input video and chooses a random start point and makes a video of between 0.999 seconds to a user defined maximum duration. (I originally made it to make this series of videos
Hope it helps!
For interactive use (the holy grail, for some) I believe Serato (not sure if that’s software or hardware - maybe both) allows for video looping, effecting and scratching like a DJ. But I don’t know nothing anything more about it than that. @decipher__ on twitch usually has a video scratch section of his streams, but he doesn’t save his videos or broadcast to a schedule so you need to get lucky and catch him live.
how to get ffmpeg edge detection filters like sobel and prewitt to work correctly, courtesy of @robp:
I had some video captures with intermittent blank frames recently, and this really helped:
Remove blank (black) frames from videos
for I in *.mp4; do
ffmpeg -i "$I" -vf blackframe=1,metadata=select:key=lavfi.blackframe.pblack:value=0:function=less -vsync cfr -c:a copy "$I-noblanks.mp4"
done
Hello there, I’m new to ffmpeg, and I’m trying to crop videos into grids of any size (2x2, 3x3 etc). This code works well for 2x2 grids but not for any number of grids greater than 2. Could you please tell me what I’m doing wrong?
for filename in os.listdir(path):
if filename.endswith(".mp4"):
video_w = 1280
video_h = 720
count = 0
w_count = 2
h_count = 2
cw=video_w/w_count
ch=video_h/h_count
for y in range(h_count):
y = video_w * y
for x in range(w_count):
x = video_w * x
command = "ffmpeg -i " + os.path.join(path,filename) + f" -vcodec h264_nvenc -vf crop={cw}:{ch}:{x}:{y} " + os.path.join(path, f"crop-{count}.mp4")
os.system(command)
count += 1```
this is the command I use when I want something unique like cutting out a 2x2 grid of 640x480 frames from the center of a 1920x1080 frame
ffmpeg -i gc.mov -filter_complex "[0]crop=640:480:380:60[tl];[0]crop=640:480:1020:60[tr];[0]crop=640:480:380:540[bl];[0]crop=640:480:1020:540[br]" -map "[tl]" topleft.mp4 -map "[tr]" topright.mp4 -map "[bl]" bottomleft.mp4 -map "[br]" -c:a copy bottomright.mp4
I’ve been wanting to try out https://chat.openai.com to see how it handles ffmpeg and it works pretty well.
this will give you a 3x3 grid.
ffmpeg -i wal.mp4 -filter_complex "[0]crop=iw/3:ih/3:0:0[a1];[0]crop=iw/3:ih/3:iw/3:0[b1];[0]crop=iw/3:ih/3:2*iw/3:0[c1];[0]crop=iw/3:ih/3:0:ih/3[d1];[0]crop=iw/3:ih/3:iw/3:ih/3[e1];[0]crop=iw/3:ih/3:2*iw/3:ih/3[f1];[0]crop=iw/3:ih/3:0:2*ih/3[g1];[0]crop=iw/3:ih/3:iw/3:2*ih/3[h1];[0]crop=iw/3:ih/3:2*iw/3:2*ih/3[i1]" -map "[a1]" output_a.mp4 -map "[b1]" output_b.mp4 -map "[c1]" output_c.mp4 -map "[d1]" output_d.mp4 -map "[e1]" output_e.mp4 -map "[f1]" output_f.mp4 -map "[g1]" output_g.mp4 -map "[h1]" output_h.mp4 -map "[i1]" output_i.mp4
it would be great to have a couple params to change to make different grid sizes but I’ve never had much luck with that.
Anyone here know how I might write to and read from a single video buffer in realtime (while respecting the actual bitstream) using ffmpeg? I’ve been trying to hack my way into this using the concat demuxer but it’s not preserving the bitstream as I would hope.