Solutions

Here on this page is listed information about possible solutions that can be used to fix validation errors.

The suggested solutions are in continuous development and using them should be carefully considered beforehand.

Migrations


Migrate audio stream from WMA file to WAVE format

The suggestion

Migrate WMA file to WAVE format using FFmpeg with default settings.

Execution

ffmpeg -i <input file>.wma <output file>.wav

Tested with: FFmpeg 6.0

Effects

Without other parameters than the input/output arguments FFmpeg selects automatically stream from the input file for migration.

The automatic selection is described in FFmpeg’s documentation: https://ffmpeg.org/ffmpeg.html#Automatic-stream-selection

Justification

The input file has single audio stream.

Migrated files

File format

Version

Specification

Description

Location

audio/x-wav

(:unap)

The file is migrated from invalid__wma7.wma using Migrate audio stream from WMA file to WAVE format

corpus

audio/x-wav

(:unap)

The file is migrated from valid__wma9.wma using Migrate audio stream from WMA file to WAVE format

corpus


Remove album cover image from MP3 file

The suggestion

Migrate only audio streams from an MP3 file to remove an attached image and related video container stream.

Execution

ffmpeg -i <input file>.mp3 -c:a copy -map 0 <output file>.mp3

Tested with: FFmpeg 6.0

Effects

Image and videocontainer streams are stripped from the output file. Only (all) audio streams are migrated to the output file.

Justification

MP3 files contain primarily audio.

Migrated files

None found


Migrate MPO file to JPEG format

The suggestion

A valid JPEG file can be created from a MPO file that contains images that complement the first otherwise valid JPEG file by removing the extra images from the file.

Execution

exiftool -MPF:All= -Trailer:All= -overwrite_original <input>.JPG

Tested with:

Effects

The main image and its headers stay unchanged. Additional images, such as a preview image and its APP2 header section, are removed. The -overwrite_original switch makes ExifTool to overwrite the input file.

Justification

MPO file format is extension of JPEG for saving multiple images into a same file.

Migrated files

None found


Migrate Apple ProRes file to FFV1 and FLAC streams in MKV container

The suggestion

All video and audio streams and the first subtitle stream are migrated into a MKV container as FFV1 video streams and FLAC audio streams. The subtitle stream is migrated as it is. The Matroska MKV container supports video, audio and subtitle streams.

Execution

ffmpeg -i <input.mov> -map 0:v -map 0:a -c:v ffv1 -level 3 -g 1 -slicecrc 1 -context 1 -c:a flac -c:s copy <output.mkv>

Tested with: FFmpeg 6.0

Effects

Video and audio streams and the first subtitle stream are migrated.

-map 0:v and -map 0:a select every video and audio stream from the input file. -c:v ffv1 and -c:a flac set FFV1 and FLAC codecs for video and audio encoding. -c:s copy copies the subtitle stream.

-level, -g, -slicecrc and -context are both general and codec-specific parameters for the encoding with FFV1 codec. Using them does not alter stream hashes from video streams: https://amiaopensource.github.io/ffmprovisr/#get_streamhash. AAC audio hashes change in the migration.

All of the following parameters for the FFV1 codec are not fully documented:

-level 3 sets encoding to FFV1 version 3 (1.3): https://www.rfc-editor.org/rfc/rfc9043#name-introduction. Earlier versions seem to be disabled at the moment in FFmpeg.

-g 1 sets interval for keyframes (group of frames) so that every frame is a keyframe: https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/refs/heads/release/6.0:/libavcodec/options_table.h#l93.

-slicecrc 1 turns on error detection for FFV1 slices used in FFV1 frames: https://git.ffmpeg.org/gitweb/ffmpeg.git/blob/refs/heads/release/6.0:/libavcodec/ffv1enc.c#l1243.

-context 1 sets bigger (rather than smaller 0) ring size for FFV1 algorithm.

Codec-specfic parameters have descriptions in FFmpeg’s documentation at https://ffmpeg.org/ffmpeg-codecs.html#Codec-Options. Rewrapping MOV container to MKV follows ffmprovisr’s method for video and audio streams: https://amiaopensource.github.io/ffmprovisr/#basic-rewrap. Modification of video and audio bitsreams can be detected by FFmpeg’s stream hashing functionality: https://amiaopensource.github.io/ffmprovisr/#get_stream_checksum.

Justification

Raw video, audio and subtitle outputs for playback are not modified.

Migrated files

File format

Version

Specification

Description

Location

video/x-matroska

4

RFC, matroska.org

The file is migration from invalid__cinepak_lpcm8.mov using Migrate Apple ProRes file to FFV1 and FLAC streams in MKV container. An unsupported plain data stream was removed in migration.

corpus

video/x-matroska

4

RFC, matroska.org

The file is migration from invalid__prores_lpcm8.mov using Migrate Apple ProRes file to FFV1 and FLAC streams in MKV container. An unsupported plain data stream was removed in migration.

corpus

video/x-matroska

4

RFC, matroska.org

The file is migration from valid__dv_lpcm8.mov using Migrate Apple ProRes file to FFV1 and FLAC streams in MKV container. An unsupported plain data stream was removed in migration.

corpus

video/x-matroska

4

RFC, matroska.org

The file is migration from valid__h264_aac.mov using Migrate Apple ProRes file to FFV1 and FLAC streams in MKV container. An unsupported plain data stream was removed and audio stream checksum changed in migration.

corpus

video/x-matroska

4

RFC, matroska.org

The file is migration from valid__h264_aac_no_ftyp_atom.mov using Migrate Apple ProRes file to FFV1 and FLAC streams in MKV container. An unsupported plain data stream was removed in migration and audio stream checksum changed in migration.

corpus

video/x-matroska

4

RFC, matroska.org

The file is migration from valid__h265_aac.mov using Migrate Apple ProRes file to FFV1 and FLAC streams in MKV container. An unsupported plain data stream was removed and audio stream checksum changed in migration.

corpus

File repairs


Recreate file with automatically selected audio and video streams

The suggestion

Copy automatically selected audio and video streams and copy ‘global metadata’ to the new file.

Execution

ffmpeg -i <input file>.MOV -c:v copy -c:a copy -map_metadata 0 <output file>.MOV

Tested with: FFmpeg 6.0

Effects

The selected audio and video streams are copied along with top-level metadata (-map_metadata 0) to the output file.

The automatic selection principles are described in FFmpeg’s documentation: https://ffmpeg.org/ffmpeg.html#Automatic-stream-selection

Justification

The file contains single audio and video streams.

Migrated files

None found


Remake PDF with Acrobat Reader

The suggestion

Open the file with Acrobat Reader and save it as a new file without any changes to the content.

Execution

Tested with:

Effects

Justification

Acrobat Reader is a standard implementation for PDF.

Migrated files

None found


Remake image with ImageMagick

The suggestion

If the bits are not completely missing, use ImageMagick. If the bits are missing JHOVE reports ‘Expected marker byte 255 ‘ from JPEG-HUL and in that case 4 bytes can be added starting from position 7 in the file. Otherwise, the file more thoroughly corrupted.

Execution

convert <input file> <output file>

Tested with:

Effects

Justification

Migrated files

None found


View and save as new file

The suggestion

Open the file in an image processing software and save it again in the same file format

Execution

Tested with:

Effects

Justification

Migrated files

None found


Recreate WAV file with single audio stream and metadata

The suggestion

Copy the first audio stream and ‘global metadata’ of the stream 0 to a new file.

Execution

ffmpeg -i <input file>.WAV -vn -c:a copy -map_metadata 0 <output file>.WAV

Tested with: FFmpeg 6.0

Effects

Only the first audio stream in the file is copied from the input file to the output file. Video streams are explicitly excluded with -vn from the migration.

Justification

Only audio stream and metadata needs to be migrated.

Migrated files

None found


Remove annotations with Ghostscript

The suggestion

Remove the annotations using Ghostscript. The process is called refrying (a PDF file).

Execution

gs -o <fixed file>.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dPreserveAnnots=false <broken_file>.pdf

Tested with:

Effects

All annotations are removed. Ghostscript will convert the file from PDF to PostScript and back to PDF again. The file may lose other features in the process.

Read more about refrying here: https://www.prepressure.com/pdf/basics/refrying

Justification

The file will now be valid, however, you lose all annotations.

Migrated files

None found

Notice: any operation suggested on this page should be carefully considered before use, as this article is in continuous development.