An MP4 can open in a player and still have missing audio, an unexpected resolution, or damaged frames near the end. If you're building a media workflow, run a quick structural check first and reserve full decoding for the exports you need to validate.
Check the streams
ffprobe -v error \ -show_entries 'format=duration:stream=codec_type,codec_name,width,height' \ -of json export.mp4 Look for a video stream with the dimensions you expected and an audio stream if the export should have sound. Compare the reported duration with the source or the intended trim. The JSON output is suitable for a script that rejects files with missing streams or unexpected dimensions. Use a small tolerance for duration comparisons so that frame rounding doesn't raise false alarms.
Decode the entire file when integrity matters
ffmpeg -v error -xerror -i export.mp4 \ -map 0:v:0 -map '0:a:0?' -f null - The null output discards decoded frames. The optional audio map also works for silent files. Use the exit status to flag decoding failures, and check the stream list separately if audio is mandatory. A clean decode still leaves subjective checks such as lip sync and whether the intended edit made it into the export.
Run the same checks on files from a youtube video downloader when you own the video or have permission to save it. Keep the original export when you have it, since platform copies can be recompressed.
Disclosure: I'm affiliated with YouTubeUltra. This post was prepared with AI assistance.
