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.<
REM Convert DAV to MP4 and Concatenate and merge Files
c:\RecordDownload\bin\ffmpeg -nostats -loglevel 0 -y -f concat -i mylist.txt -vcodec libx264 -crf 24 -filter:v "setpts=1*PTS" MERGED.mp4
REM Take merged video and speed it up for survey
c:\RecordDownload\bin\ffmpeg -nostats -loglevel 0 -i MERGED.mp4 -filter:v "setpts=0.1*PTS" FASTMERGED.mp4
This is what I used for a windows batch file that works, but I have found empirically that the amount of data generated by 6 3MP or 4MP cameras is overwhelming to process. I don't know if this will help
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.
sudo apt install ffmpeg
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()
python convert.py
Using ffmpeg from dav to mp4
ffmpeg -y -i input-file.dav -c:v libx264 -crf 24 output-file.mp4
I use for security cameras and add -filter:v "setpts=3*PTS"
param to slow video.
Reference to solution here
I spend few hours on unsuccessful attempts to do it with ffmpeg.
Problems: lower fps, processing stopping on with no frame
error. Seems camera merges video stream in way that ffmpeg can't understand.
As I research, .DAV
is kinda closed format from Dahua
company.
Smart Player
has ability to export video to AVI and it works for me. But it's Windows software.
for %%i in (*.dav) do (
ffmpeg -i "%%i" -c:v libx264 "%%~i.mp4"
)
done
Try this for batch conversation. I have used another version of this to convert images & mp3's to videos. You probably need to tweak it a liitle to fit your needs.
ffmpeg
doesn't support DAV
(yet) as shown by ffmpeg -formats
.
The reason why it appears to work for a while is because DAV
is a Chinese modified version of H.264/AVC
. ffmpeg
attempts to guess your input format and it settles on its standard H.264
decoder as the best available match.
The decoding obviously fails at some point since DAV
has vendor specific modifications. The format is also proprietary.
You can see this by running the following command:
ffprobe -i input.dav -v debug
The result is:
[h264 @ 0x264ec00] Format h264 probed with size=2048 and score=51
The score is only 51/100
.