Skip to content

Instantly share code, notes, and snippets.

@Eagle-E
Eagle-E / gist:eac9244b7599a4d56bf988de2776fff5
Created February 21, 2024 17:37
ffmpeg extract frames from video
ffmpeg -i video.mp4 -r 10 -s 640x360 -q:v 2 -vframes 25 frame%03d.jpg
# -r = frames per second
# -vframes = number of total frames to extract
# -s = resolution (width x height)
# -q:v = quality of extracted frames, 1 (highest) to 31 (lowest quality)
# frame%03d.jpg = output path (i.e. frame000.jpg, frame001.jpg, ...)
@Eagle-E
Eagle-E / gist:5b4095a60da5299ce229634386ae865f
Created February 21, 2024 17:22
ffmpeg remove audio from video
input_file=example.mkv
output_file=example-nosound.mkv
ffmpeg -i $input_file -c copy -an $output_file
def sample_points_on_sphere(radius = 1, vres = 10, hres = 10):
""" Sample points on a sphere that has the given radius.
Args:
- vres: vertical resolution, the amount of heights at which the sphere will
be sampled, the vertical distances are sampled at even distances
- hres: horizontal resolution, same as vres but horizontally
"""
def sample(r, theta, phi):
x = r * np.sin(theta) * np.cos(phi)
y = r * np.sin(theta) * np.sin(phi)
// 0.809017 = (1.0f + sqrt(5.0f)) / 2 / 2 (half the length of the golden rectangle)
vertices:
(-0.809017, 0, 0.5)
(-0.809017, 0, -0.5)
(0.809017, 0, -0.5)
(0.809017, 0, 0.5)
(-0.5, 0.809017, 0)
(0.5, 0.809017, 0)
(0.5, -0.809017, 0)
(-0.5, -0.809017, 0)