[ffmpeg] How to check a mp4 audio/video duration without re-encode

Agathakuan
1 min readJan 26, 2021

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 ?

Step 0. download or build ffmpeg

please follow [[ https://www.wikihow.com/Install-FFmpeg-on-Windows]]

Step 1.copy target clips to ffmpeg folder

$ 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

$ ffprobe -show_frames -select_streams v -of xml <mp4 clip name>.mp4 > video_<mp4 clip name>.info$ ffprobe -show_frames -select_streams a -of xml <mp4 clip name>.mp4 > audio_<mp4 clip name>.info

Originally published at http://programnoteagatha.blogspot.com. << my old blogger

--

--

Agathakuan
0 Followers

embedded system software engineer, ballet beginner