mov 转 mp4 并改2X速

ffmpeg -i -y -vf "setpts=.5*PTS" -r 24 test1.mp4
ffmpeg -ss 00:33:15 -i input.MTS -t 00:02:00 -vcodec copy -acodec copy output.mts
ffmpeg -i input.mts -vcodec mpeg4 -b:v 8M -acodec copy output.mp4
$ cat mylist.txt file '/path/to/file1' file '/path/to/file2' file '/path/to/file3' $ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4 timelapse:
ffmpeg -i 1.MTS -y -vf "setpts=.02*PTS" -r 24 sunrise.MTS
timelapse + convert to mp4
ffmpeg -i output.mts -y -vf "setpts=.0025*PTS" -r 60 -vcodec mpeg4 -b:v 15M -an sunrise.mp4
motion detection
for i in 1 2 3
do ffmpeg -i 0000$i.MTS -codec copy -map 0 output$i.mkv
motion config file:
netcam_url "file:////path/to/output.mkv"
camera_name "localfile"
camera_id 1
width 1280
height 720
framerate 29
movie_output on
text_right ""
movie_max_time 0
movie_codec mp4
movie_quality 80
movie_bps 1200000
pre_capture 10
post_capture 10
on_event_start "echo %v,%{fps},%T,%q >> event.start.txt"
on_event_end "echo %v,%{fps},%T,%q >> event.stop.txt"
on_camera_lost "killall motion"
threshold 200000
log_file "motion.log.txt"
run motion:
motion -c camera.conf

wav 转换并切除最后N秒

for f in *].mp3
  ffmpeg -y -i "$f" -acodec pcm_s16le -ac 1 -ar 16000 -map_metadata -1 \
         -t $(( $(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$f" | cut -d\. -f1) - $n)) tmp.wav
  ffmpeg -y -i tmp.wav "${f/\[\].mp3/.mp3}"
  rm tmp.wav
  rm "$f"


-c:v libx264 tells it to use the libx264 encoder,

crf 20 uses the Constant Rate Factor quantiser (which paradoxially means variable bit rate, but constant quality) with a value of 20 (pretty good quality; lower is better quality / larger files, higher is crappier / smaller),

the slow preset is a shortcut for a bunch of encoder settings that means it puts a bit more effort into it than the default (medium).

ffmpeg -i in.mkv -c:v libx264 -crf 20 -preset slow out.mp4
nohup ffmpeg -i in.mkv -vf scale=-1:720 -c:v libx264 -crf 20 -preset slow -c:a copy out.small.mkv > log.txt 2>&1 &


电子邮件地址不会被公开。 必填项已用*标注