40823102 cd2021

  • Home
    • Site Map
    • reveal
    • blog
  • About
  • Stage1
    • W1
    • W2
    • W3
    • W4
  • Stage2
    • W5
    • W6
    • W7
    • W8
    • W9
  • Stage3
    • W10
    • W11
    • W12
    • W13
    • W14
    • W15
    • W16
    • W17
    • W18
W3 << Previous Next >> Stage2

W4

第四週預定進度:上台報告

2021-協同產品設計實習-stage1-ag5報告書

2021-協同產品設計實習-stage1-ag5影片

各組簡報所花費的時間

討論

若檔案數較大應如何若檔案數較大應如何計算各組花費時間?

除了手動逐一計算外,透過參考文獻我們發現可用ffprobe來使用外部指令,也就是從FFmpeg Wiki運行以下命令

import subprocess

def get_length(filename):
    result = subprocess.run(["ffprobe", "-v", "error", "-show_entries",
                             "format=duration", "-of",
                             "default=noprint_wrappers=1:nokey=1", filename],
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT)
    return float(result.stdout)

也可以-printm_format json與-show_streams json一起使用

參考資料:https://stackoverflow.com/questions/3844430/how-to-get-the-duration-of-a-video-in-python


W3 << Previous Next >> Stage2

Copyright © All rights reserved | This template is made with by Colorlib