2020年6月13日 星期六

[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: 
Step 0. download or build ffmpeg 
for Windows
please follow [[https://www.wikihow.com/Install-FFmpeg-on-Windows]]

Step 1.copy target clips to ffmpeg folder

For concatenate clips:
Step 2.
$ 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 informantion with ffprobe
for video info:
$ ffprobe -show_frames -select_streams v -of xml <mp4 clip name>.mp4 > video_<mp4 clip name>.info
for audio info:
$ ffprobe -show_frames -select_streams a -of xml <mp4 clip name>.mp4 > audio_<mp4 clip name>.info

沒有留言:

張貼留言