Verify an Uploaded Video Archive on a VPS Before Streaming
Verifying a video archive on a virtual private server (VPS) helps catch incomplete uploads, damaged archives, and files that will not play before viewers encounter them. You will check the archive’s integrity, extract it safely, inspect the video files, and test playback without making the files publicly accessible.
What You’ll Need
- SSH access to the VPS and permission to read the uploaded archive and write to its destination folder.
- The archive’s full path and, if available, a checksum or file size supplied by the upload source.
- A shell account with tools such as
file,unziportar, andffprobe. Install missing tools using your distribution’s package manager, or ask the server administrator. - Enough free disk space for the archive, extracted files, and any temporary files. Video extraction can require substantially more space than the compressed archive.
Step-by-Step
- Connect and locate the upload. Log in over SSH, then move to the upload directory or use the archive’s full path. For example:
cd /srv/uploads, followed byls -lh. Confirm the name and size. If the file is not where expected, check the upload client’s destination and any server-side temporary directory. - Check available storage and identify the format. Run
df -h /srv/uploadsto see free space on the relevant filesystem. Identify the archive withfile video-archive.zip, replacing the name as needed. Do not assume a file is a ZIP just because it has a.zipextension. Make sure there is room for extraction before proceeding. - Compare a checksum if you have one. Ask the sender or upload process for a SHA-256 checksum generated from the original archive. On the VPS, run
sha256sum video-archive.zip. Compare the full hash, character for character. On macOS, the corresponding command isshasum -a 256. A matching checksum strongly indicates that the archive arrived unchanged; it does not prove that the video content itself is valid. If no original checksum exists, record the VPS hash for future comparisons, but do not treat it as proof of a correct upload. - Test the archive before extracting. For ZIP files, use
unzip -t video-archive.zip. For a gzip-compressed tar archive, usegzip -t video-archive.tar.gz; for other tar formats, usetar -tf video-archive.tarto check that the table of contents can be read. Follow the tool’s error messages and verify it completes successfully. If the format is unfamiliar or the command reports corruption, do not stream from it or overwrite the only copy; ask for a fresh upload. - Inspect archive contents and extract to a private directory. List the files first with
unzip -l video-archive.ziportar -tf video-archive.tar.gz. Look for unexpected paths, files, or unusually large contents. Create a separate destination, such asmkdir -p /srv/media/staging, and extract there. For ZIP, useunzip video-archive.zip -d /srv/media/staging; for tar.gz, usetar -xzf video-archive.tar.gz -C /srv/media/staging. Do not extract an archive from an untrusted source as a privileged user. If the listing contains absolute paths or parent-directory components such as../, stop and inspect it rather than extracting blindly. - Check extracted files and permissions. Run
find /srv/media/staging -type f -printf '%p %s bytes\n'on systems with GNU find, or usefind /srv/media/staging -type fto list files portably. Confirm that expected videos exist and are nonzero in size. Ensure the account or service that will stream them can read them, without making the directory world-writable. Avoid changing permissions recursively until you know which user runs the streaming service. - Probe each video’s streams and metadata. If FFmpeg tools are installed, run
ffprobe -v error -show_entries format=duration,size:stream=codec_type,codec_name,width,height,sample_rate,channels -of json /srv/media/staging/example.mp4. Check that the output includes a plausible duration and expected video and audio streams. Repeat for each file, or use a shell loop if you are comfortable handling filenames with spaces. A successful probe is a useful check, but it cannot guarantee that every frame decodes correctly. - Decode-test the video, then test playback privately. Run
ffmpeg -v error -i /srv/media/staging/example.mp4 -f null -. A clean completion without decode errors is a stronger integrity check; warnings or errors may indicate a damaged file or unsupported stream. Then test a short segment in a player or through a temporary, access-controlled staging route. Confirm picture, sound, seeking, and any required subtitles. Keep staging files outside the public web root, and do not expose a test endpoint without appropriate access controls. - Promote only verified files. Once checks pass, move or copy the videos into the intended media location, confirm the streaming service can read them, and test the actual playback path. Keep the original archive until the new files have been verified and any required backup is complete.
Common Mistakes
- Checking only the archive’s filename or size. Neither confirms that the upload matches its source or that videos decode.
- Comparing a checksum with one generated from the same uploaded file. That only records the current file; you need a trusted checksum from before or during upload for a meaningful comparison.
- Extracting into a public media directory before inspecting contents. Use a private staging directory first, especially for archives from other people.
- Assuming a readable metadata report means a complete video. Probe tools may read headers even when later portions are damaged; perform a decode test as well.
- Changing ownership or permissions broadly to fix playback. First identify the service account and grant only the read access it needs.
Tips
- Keep a manifest containing filenames, sizes, and SHA-256 checksums alongside the verified files. Regenerate or compare hashes after copying if you need to confirm the copy.
- For large archives, monitor disk space during extraction. Stop if the filesystem approaches capacity; a full disk can interrupt extraction or affect other services.
- Run long checks in a persistent terminal session, such as
tmuxorscreen, if your SSH connection may drop. - When a file passes local checks but streams poorly, investigate the streaming server’s supported containers and codecs, network delivery, and transcoding settings separately. Integrity and playback compatibility are different checks.
Troubleshooting
The archive test reports errors: Check that the upload finished and that the expected format matches the command. Compare the source checksum if available. If the hash differs or the archive remains unreadable, upload it again, preferably with a transfer method that can resume and verify the completed file.
Extraction fails or runs out of space: Check df -h on the destination filesystem and inspect the archive’s listed contents. Free space safely or choose a larger filesystem; do not delete the only source copy before successful extraction. If permissions fail, check directory ownership and access rather than running the whole process as root.
ffprobe or ffmpeg is not found: Install the distribution’s FFmpeg package if you have administrator approval, or ask the VPS administrator to provide the tools. Do not download an unverified executable from an unknown source.
The decode test reports errors, or playback has no sound: Test another file and inspect the reported streams. Re-extract from the archive if it passed integrity checks, then compare the extracted file with the original source where possible. Missing audio may mean the file has no audio stream, uses an unsupported codec, or has a damaged track; metadata alone cannot distinguish every case.
The file plays locally but not through the stream: Verify the service’s read permissions and configured media path, then check server logs and codec/container support. Test the stream from a client device and network similar to the audience’s. Do not make the directory broadly public as a shortcut.
Frequently Asked Questions
Does a matching SHA-256 checksum prove the video is good?
No. It confirms the archive matches the file used to create the trusted checksum. The original could still contain a broken video, so test the archive and decode the extracted media.
Can I verify an archive without extracting it?
You can test its structure and compare its checksum without extraction. To confirm the video streams themselves decode, you generally need to extract the files and run a media probe or decode test.
Is ffprobe enough to verify a video?
It checks whether media streams and metadata can be read, but it may not decode the entire file. Use an FFmpeg decode test for a more thorough check, then test actual playback.
How much disk space should I allow?
Check the archive’s contents and available filesystem space first. Extracted files may be larger than the archive, and temporary copies or transcoding can require additional room; there is no single safe multiplier for every format.
Should I delete the archive after extraction?
Not until the extracted videos have passed checks and any required backup or retention step is complete. Keeping the archive temporarily gives you a source for re-extraction if a copy is damaged.
Can I test streaming before making the files public?
Yes. Use a private staging route, authenticated test access, or a local player. Keep the files outside a public web root and remove temporary access when testing is finished.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.