0

We have a surveillance camera recording taken at intervals of a month. It is necessary to remove the dark time of the day (night recordings) from the record or from the video file by deleting all frames with a black pixel ratio of more than 30%.

I perform the following steps:

  • step 1 - speeding up all files attached to the directory *.mp4:
for %%i in (".mp4") do ffmpeg -i %%i -r 30 -filter:v "setpts=1/3600*PTC" "Output\%%i"
  • step 2 - merge accelerated *\Output files into *.mp4:
ffmpeg -f concat -safe 0 -i list.txt -c copy General(h_264).mp4
  • step 3 - convert to H.265 codec *.mp4:
ffmpeg -i General(h_264).mp4 -vcodec hevc TimeLapse(h_265).mp4
  • The solution came from @Gantendo - As a result, I get a *. mp4 file without 27% of frames exceeding 98% of black pixels. (I can only explain it this way):
ffmpeg -i in.mp4 -vf "blackframe=amount=0:threshold=98, metadata=select:key='lavfi.blackframe.pblack':value=27:function=less" -vsync 0 img%d.mp4
11
  • More detail is required, brand, model numbers, sample image Commented Jul 25, 2023 at 3:14
  • @RohitGupta I have an original and converted by me to Timelapse video file from the Hikvision recorder in h.264 codec 30 FPS mp4 resolution Commented Jul 25, 2023 at 4:59
  • Processing is carried out by ffmpeg Commented Jul 25, 2023 at 5:11
  • Hello, what did you try? You should also edit the question whenever you add more details.
    – Destroy666
    Commented Jul 27, 2023 at 20:15
  • 1
    I didn't propose anything. Your question is still not fully clear because of language, but it's close to being understandable and answerable now. Edit the 1st paragraph to be as clear and detailed as possible as to what exactly should be the criteria for cropping/deletion.
    – Destroy666
    Commented Jul 28, 2023 at 10:07

0

You must log in to answer this question.

Browse other questions tagged .