FFMPEG: Get the Scene Change Detection value for all frame

前端 未结 2 1504
-上瘾入骨i
-上瘾入骨i 2020-12-17 05:02

I\'m trying to measure how much a movies is \"fast\" (more action in the screen and quick scene chances). I don\'t want just a single value for the movie, but values along t

相关标签:
2条回答
  • 2020-12-17 05:49

    I found it hard to parse the ffmpeg output, so I created a wrapper in Python:

    pip3 install scenecut_extractor
    

    It will by default extract the scene cuts based on a threshhold, so it'll give you all that are above the parameter:

    $ scenecut_extractor /path/to/file.mp4
    

    Will output JSON by default:

    [
      {
        "frame": 114,
        "pts": 114.0,
        "pts_time": 3.8,
        "score": 0.445904
      },
      {
        "frame": 159,
        "pts": 159.0,
        "pts_time": 5.3,
        "score": 0.440126
      }
    ]
    

    You can set -t 0 to extract everything. Check -h for more options.

    0 讨论(0)
  • 2020-12-17 06:03

    Use

    ffmpeg -i in.mp4 -vf "select='gte(scene,0)',metadata=print:file=scenescores.txt" -an -f null -
    

    The text file created will have output like this:

    ...
    frame:1440 pts:737280  pts_time:48     
    lavfi.scene_score=0.003069
    frame:1441 pts:737792  pts_time:48.0333
    lavfi.scene_score=0.001593
    frame:1442 pts:738304  pts_time:48.0667
    lavfi.scene_score=0.000077
    frame:1443 pts:738816  pts_time:48.1   
    lavfi.scene_score=0.002219
    ...
    
    0 讨论(0)
提交回复
热议问题