[ffmpeg] How to check a mp4 audio/video duration without re-encode
文章目录
Condition:
Reecently implement a audio/video muxer with libffmpeg with 15 h264 fps video track and 8000khz aac audio track. THese two bitrate can not be devided by each each other. I find two solution:
1.find track info of each frame
2.concatenate clips with continuous recording, then watch the output to check
- audio/video frame loss or not?
- have the same duration ?
both we need
download or build ffmpeg for Windows
please follow install ffmpeg for windows
copy target clips to ffmpeg folder
only for concatenate clips
concatenate
$ cd <ffmpeg path>
$ (for %i in (*.mp4) do @echo file '%i') > mylist.txt
$ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
For analyse frame information with ffprobe for video info
$ ffprobe -show_frames -select_streams v -of xml <mp4 clip name>.mp4 > video_<mp4 clip name>.info
For audio
$ ffprobe -show_frames -select_streams a -of xml <mp4 clip name>.mp4 > audio_<mp4 clip name>.info