Trim a video (no re-encode)
Copy 5 seconds starting at 0:30, without re-encoding:
ffmpeg -ss 00:00:30 -i orig.mp4 -t 00:00:05 -c copy new.mp4Fibonacci speed test
A quick, CPU-bound benchmark for comparing machines:
import time
def fib(n):
return 1 if n <= 1 else fib(n - 1) + fib(n - 2)
start = time.perf_counter()
print(fib(40))
print(f"{time.perf_counter() - start:.2f} sec")Rename files
Using the Perl rename tool (brew install rename on macOS):
# lower-case
rename 'y/A-Z/a-z/' *
# swap spaces for dashes
rename 'y/ /-/' *Capture a webcam frame
Grab one frame from the webcam, two seconds in (Linux; on macOS use -f avfoundation -i "0"):
ffmpeg -y -f v4l2 -video_size 640x480 -i /dev/video0 -ss 2 -frames:v 1 capture.jpg