Skip to content

How can I screen a batch of MP4 files for decode errors before spending credits?

Run a complete local decode into a null output, retain the exit status and error log, and quarantine any failed source before preparing a paid generation. This is a stronger automated screen than checking a poster or file size, but it only tests the installed decoder and selected streams. It neither certifies the intended performance nor guarantees that a different browser or service accepts the file.

MEDIA DIAGNOSTICS: FILES, STREAMS AND CLOCKSAISwapLab team · Editorial methodPublished 3 min read
See the recorded exampleExplore 67 Image SkillsIndependent finishing · Check the actual file
Editorial worksheet excerpt: Decoder pass; Decoder failure; Not executed. See the complete table and sources below.
Editorial worksheet excerpt: Decoder pass; Decoder failure; Not executed. See the complete table and sources below.

Whole-file screening record

A whole-file screen is useful when an editor receives many short source candidates. It must remain distinct from a repair procedure: decoding to null writes no new video and reconstructs no missing frames. The useful artifact is a per-file report that distinguishes a successful decoder pass, a failed command and an untested creative requirement. Keep the original inputs read-only. Once a source passes, still inspect people, action, length and permissions before considering it ready for AISwapLab existing-video replacement.

Build the evidence

  1. 01

    Choose the streams that matter

    The example selects the first non-attached-picture video and optionally the first audio stream. That is a screening policy, not a universal multi-camera choice. Inventory complicated containers first and change mapping to the approved tracks. If a silent source is valid, optional audio avoids turning absence into an automatic error; if audio is required by your brief, check that requirement separately and fail it explicitly.

  2. 02

    Decode completely and preserve the outcome

    Run the command without a short duration or read interval so it reaches the selected streams' ending. Error logging and xerror make the process stop on reported errors, while the null sink avoids creating another compressed master. Save the command, executable version, stderr and exit code. An empty error log alone is not a reliable pass if the process never started or the exit status was lost.

  3. 03

    Route failures rather than silently skipping them

    A batch controller should record every intended input, including launch failures and missing files. Move none of the originals automatically. Mark a failed screen for an authorized fresh copy or specialist inspection, and include its failure timestamp where available. Mark a successful screen as decoder-pass only. Follow with ordinary-speed picture and sound review so an entirely wrong but well-formed file cannot reach upload unnoticed.

A bounded example

Local executed example: a six-second synthetic H.264/AAC MP4 was decoded with the listed stream mapping, error policy and null sink under FFmpeg 7.1. The process exited zero and produced no error output. That establishes this fixture's decoder pass, not a corruption-detection sensitivity benchmark: no truncated-file fixture or paid AISwapLab generation was included. A production report must preserve its own actual command outcome for every input. Retain the decoder version in the report.

Local diagnostic commands

The FFmpeg screening command was executed successfully on a local six-second synthetic test pattern with AAC sound. The Python batch wrapper is illustrative and has not been run as a production batch. No paid generation was performed.

shell
ffmpeg -hide_banner -nostdin -v error -xerror -i source.mp4 -map 0:V:0 -map 0:a:0? -f null -
# Capture the process exit status in your batch runner as well as stderr.
# Example Python launcher:
import subprocess
result = subprocess.run(["ffmpeg", "-hide_banner", "-nostdin", "-v", "error",
    "-xerror", "-i", "source.mp4", "-map", "0:V:0", "-map", "0:a:0?",
    "-f", "null", "-"], capture_output=True, text=True)
print({"exit_code": result.returncode, "stderr": result.stderr})

Whole-file screening record

StateRequired evidenceNext decision
Decoder passCompleted process and exit zeroReview content and upload constraints
Decoder failureExit status and error logObtain complete copy or investigate
Not executedLaunch or file-access failureFix screening process; no media verdict

Acceptance evidence

  • The report covers every intended input and records process launch failures.
  • A pass requires successful completion and retained exit status, not just an empty file.
  • The selected tracks match the intended preparation policy.
  • Creative content, upload size and browser playback receive separate checks.

Stop condition

Stop before upload when a required region fails repeatedly or a command did not complete. Obtain a complete authorized original before attempting a separate compatibility export. If a file decodes locally but fails elsewhere, investigate the differing environment; do not claim the successful local pass proved universal compatibility or recovered absent material.

Sources

Review the result in context.

Compare the recorded example and its documented limitations.

See the recorded example