ffmpeg
szcf-weiya opened this issue · 1 comments
szcf-weiya commented
second way to speed up
https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
ffmpeg -i VID_20220623_183559.mp4 -map 0:v -c:v copy -bsf:v h264_mp4toannexb VID_20220623_183559_raw.h264
ffmpeg -fflags +genpts -r 120 -i VID_20220623_183559_raw.h264 -c:v copy VID_20220623_183559_r120.mp4
However, it might throw the following error,
not enough frames to estimate rate; consider increasing probesize
try
ffmpeg -fflags +genpts -probesize 2G -r 120 -i VID_20220623_183559_raw.h264 -c:v copy VID_20220623_183559_r120.mp4
otherwise, it might behave like
but note that in this method, the size of the video would not decrease, i.e., no loss.
see also: https://zhuanlan.zhihu.com/p/142593316
szcf-weiya commented
add mosaic at a static position via crop and overlay
- create a snapshot and then open with
geeqie
, which can show the pixel coordinate of the cursor, determine the start position (left corner) and the width and height of the region to be blur
ffmpeg -i test.mp4 -filter_complex "[0:v]crop=210:20:47:233,avgblur=20[fg];[0:v][fg]overlay=47:233[v]" -map "[v]" -map 0:a -c:v libx264 -c:a copy -movflags +faststart test2.mp4
where
210:20:47:233
indicates the start position is at(47, 233)
, and the(width, height)
are210x20
overlay
means that we crop the region and blur it and finally overlay on the original figure
see also: https://superuser.com/questions/901099/ffmpeg-apply-blur-over-face
similarly, we add another mosaic region,
ffmpeg -i test2.mp4 -filter_complex "[0:v]crop=142:20:372:212,avgblur=20[fg];[0:v][fg]overlay=372:212[v]" -map "[v]" -map 0:a -c:v libx264 -c:a copy -movflags +faststart test3.mp4
since the right corner is empty, so crop them out
ffmpg -i test3.mp4 -filter:v "crop=680:630:1:1" -c:a copy test4.mp4
the resulting video is here