ffmpeg conversion .dav to any video files

前端 未结 6 1891
再見小時候
再見小時候 2021-02-14 13:12

I am trying for days to convert .dav file (file generated by dvrs [image recorders]). I have tried several variations with ffmpeg and can not succeed.<

6条回答
  •  温柔的废话
    2021-02-14 13:40

    I have gone through above process and it was quite successful, only limit was in performing the operation with multiple files in batch. So, I came up with following solution.

    1. First install ffmpeg

    sudo apt install ffmpeg

    1. Save following as convert.py then
    import subprocess
    from os import listdir
    from os.path import isfile, join
    onlyfiles = [f for f in listdir(".") if isfile(join(".", f))]
    
    c=1
    for i in onlyfiles:
        
        c=c+1
        list_dir = subprocess.Popen(["ffmpeg", "-y","-i",i,"-c:v","libx264","-crf","24",i[:-4]+".mp4"])
        list_dir.wait()
    
    1. Run the code python convert.py

提交回复
热议问题