iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
To convert a video on a Linux VPS, install FFmpeg, inspect the source with ffprobe, select a container and codecs for the intended player, run a clearly documented command, and verify the resulting file. A reliable job also leaves enough disk space for the source, destination and temporary data, uses safe filenames, records logs, and limits concurrency so other services remain usable.
The smallest working example is ffmpeg -i input.mp4 output.avi. In production, replace that implicit choice with explicit video and audio codecs, quality controls, filters and stream mapping that match your delivery requirements.
What FFmpeg does on a VPS
FFmpeg is a command-line media converter that can read local files, pipes and network streams and write one or more outputs. The FFmpeg project describes it as “ffmpeg is a universal media converter.” On a headless VPS, there is no desktop application to hide defaults: every input, codec, filter, output path and error is visible in the command and its log.
Keep four layers separate when planning a job:
- Container (muxer): the file format such as MP4, Matroska or MPEG transport stream. It determines how streams and metadata are packaged.
- Codecs: the video and audio compression formats inside the container. A player must support both the container and the codecs.
- Filters: transformations such as scaling, cropping, deinterlacing or subtitle rendering. Filters normally require decoding and re-encoding.
- Protocols and I/O: local paths, pipes, HTTP inputs or other sources and destinations.
Those layers explain why changing a filename extension is not a conversion. FFmpeg must be told, or must infer, how to decode the input and create a compatible output.
Prepare the Linux VPS
Install a suitable FFmpeg build
Use the package supplied by your Linux distribution or a maintained FFmpeg build. Repository names and enabled codec features differ, so record exactly what is installed:
- On a Debian- or Ubuntu-based system, refresh package metadata and install the distribution package with
sudo apt updatefollowed bysudo apt install ffmpeg. - On a Fedora-, Rocky- or other DNF-based system, install the package with
sudo dnf install ffmpegwhen it is available in your enabled repositories. - Confirm the binary and build configuration with
ffmpeg -version. Save this output with your job logs when conversions must be reproducible.
If a required encoder, decoder or hardware component is absent, changing the command cannot add it. Install a build that includes the feature, or use software codecs that the current build exposes.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Check permissions, paths and capacity
Run the conversion as the account that owns the source or has read access to it. The same account needs write and execute permission on the destination directory. Before a large job, check capacity with df -h and inspect the working directory with du -sh /path/to/work.
Reserve room for the original file, the completed output, any temporary output and filesystem overhead. A failed conversion can leave a partial file, so do not plan on having only the final file’s size available. If the VPS also serves a website, database or backup process, leave headroom for their disk I/O and memory rather than filling the volume with a batch queue.
Decide how a long command will stay alive
An SSH session is a poor job manager for multi-hour work. Use a terminal multiplexer such as tmux, a service manager, or a queue worker. Redirect standard output and errors to a log file, and retain the command line, FFmpeg version and exit status alongside the output.
Inspect the input before choosing settings
Start with ffprobe input.mp4. It reports streams, codecs, dimensions, frame rate, duration, time base and metadata. The regular FFmpeg input log also exposes much of this information, but ffprobe is easier to use in scripts.
For a compact, script-friendly summary, use:
ffprobe -v error -show_entries format=duration:stream=index,codec_type,codec_name,width,height,r_frame_rate,channels,sample_rate -of default=noprint_wrappers=1 'input.mp4'
Answer these questions before writing the output command:
- How many video, audio, subtitle and attachment streams are present?
- Which video dimensions, frame rate and pixel format must be retained?
- Is the source interlaced, rotated or carrying subtitles that must remain selectable or be burned into the picture?
- Does the target player accept the source codecs, allowing a stream copy instead of a quality-changing transcode?
- Will the destination be a local file, a web download, a pipe or another service with its own format restrictions?
Stream inspection prevents common mistakes such as converting the first audio track when the desired language is a later stream, or producing a file that has video but no compatible audio.
Choose a container and codecs
Choose for the player or downstream service first, then tune quality and speed. The following are practical starting points; verify the target platform’s current requirements before batching thousands of files.
| Delivery goal | Container | Typical video choice | Typical audio choice | Operational trade-off |
|---|---|---|---|---|
| Broad web and device playback | MP4 | H.264 encoder such as libx264 |
AAC encoder such as aac |
Usually easy to play, with CPU time determined by the encoder, preset and quality setting. |
| Archival file with flexible stream support | Matroska (MKV) | A codec supported by the archive workflow | A codec supported by the archive workflow | Can carry many stream types, but some consumer players do not accept every combination. |
| Existing streams already meet the target | A container compatible with those streams | Copy with -c:v copy |
Copy with -c:a copy |
Fast and avoids generation loss, but cannot change dimensions, bitrate, frame rate or incompatible codecs. |
Container compatibility is not codec compatibility. An MP4 extension does not guarantee that a particular player supports the video profile, audio format, subtitle type or level inside it. Conversely, re-encoding a stream that is already acceptable wastes CPU and can reduce quality.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Run a basic conversion
The documented pattern
FFmpeg’s command synopsis is ffmpeg [global_options] {[input_file_options] -i input_url} ... {[output_file_options] output_url}. Anything that is not interpreted as an option is treated as an output URL. The minimal documented example is:
ffmpeg -i 'input.mp4' 'output.avi'
Options apply according to their position. Input options belong before the corresponding -i; output options belong before the output path. Put the output path last and quote paths that contain spaces, parentheses, brackets or shell metacharacters.
A practical MP4 transcode
ffmpeg -i 'input.mov' -map 0:v:0 -map 0:a:0? -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 128k 'output.mp4'
This command makes each decision visible:
-i 'input.mov'opens the source. The single quotes are shell quoting, not FFmpeg syntax.-map 0:v:0selects the first video stream from input 0.-map 0:a:0?selects the first audio stream when one exists; the question mark prevents failure for a silent source.-c:v libx264selects software H.264 encoding.-preset mediumchooses an encoder speed/compression trade-off. Faster presets generally consume less CPU time per frame while producing a less compression-efficient result at the same quality target; benchmark on the actual VPS instead of promising a throughput number.-crf 23requests constant-quality operation for this encoder. Lower values normally retain more quality and create larger files; test representative material and set a policy for your library.-c:a aac -b:a 128kencodes audio as AAC at the requested nominal bitrate.
Use a different quality target, audio bitrate or encoder when the player, storage budget or source content requires it. Do not copy this command blindly when the input contains multiple languages, commentary tracks or subtitles; map those streams deliberately.
Remux without re-encoding
When inspection shows that the existing streams are compatible with the destination container, copy them:
ffmpeg -i 'input.mkv' -map 0 -c copy 'output.mp4'
This changes the container rather than the compressed media. It is fast and avoids another generation of loss, but it fails if the selected streams cannot be stored in the destination or if the target player rejects their codecs. Remove unwanted streams with explicit maps instead of assuming stream order.
Extract audio as a separate output
ffmpeg -i 'input.mp4' -map 0:a:0 -vn -c:a aac -b:a 192k 'audio.m4a'
-vn disables video in this output. If the source audio is already suitable for the destination, replace the audio encoder with -c:a copy and choose a matching extension and container.
Rank #3
Add filters only when the output needs them
Scaling, cropping, deinterlacing and burned-in subtitles require a filter chain. A filter normally means the affected stream is decoded and encoded again, so keep the filter visible in the command and account for its CPU and quality cost.
Scale while preserving aspect ratio
ffmpeg -i 'input.mp4' -vf 'scale=1280:-2' -c:v libx264 -crf 23 -c:a aac -b:a 128k 'output-720p.mp4'
The width is set to 1280 pixels and the height is calculated from the source aspect ratio; -2 requests an even result suitable for common encoders. Choose dimensions from the target device or bandwidth policy rather than scaling every file to one arbitrary size.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchCrop black borders
ffmpeg -i 'input.mp4' -vf 'crop=iw:ih-160:0:80' -c:v libx264 -crf 23 -c:a copy 'cropped.mp4'
This example removes 80 pixels from the top and bottom. Measure the source first; hard-coded crop values are appropriate only when the input layout is known. If the audio can be copied, -c:a copy avoids unnecessary audio encoding.
Deinterlace
ffmpeg -i 'interlaced.mpg' -vf 'yadif' -c:v libx264 -crf 23 -c:a aac -b:a 128k 'progressive.mp4'
Use deinterlacing only for interlaced material. Confirm the source scan type with inspection or a trusted media workflow; applying it to progressive video adds processing without solving a problem.
Burn subtitles into the picture
ffmpeg -i 'input.mkv' -vf "subtitles='captions.srt'" -c:v libx264 -crf 23 -c:a copy 'burned-subtitles.mp4'
Burned subtitles cannot be turned off and require video re-encoding. If the target player supports selectable subtitle streams, preserve or map the subtitle stream instead of rendering it into every frame.
Map streams deliberately
Automatic stream selection is convenient for simple files but can select an unexpected language or omit a stream the target needs. Use -map for repeatable jobs:
ffmpeg -i 'movie.mkv' -map 0:v:0 -map 0:a:0 -map 0:a:1? -map 0:s:0? -c:v libx264 -crf 23 -c:a aac -c:s mov_text 'movie.mp4'
The question mark after an optional map suppresses an error when that stream does not exist. Subtitle codec support varies by container and player, so test the result on the actual playback targets. If you need every stream, -map 0 is explicit, but the destination container may not accept all of them.
Make automated jobs safe
Use temporary files and atomic renames
Never let consumers mistake a partially written file for a finished video. Write to a unique temporary name in the same destination filesystem, check FFmpeg’s exit status, then rename it:
#!/usr/bin/env bash
set -u
src=$1
out=$2
tmp="$out.part.$$"
log="$out.log"
if ffmpeg -y -i "$src" -map 0:v:0 -map 0:a:0? -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 128k "$tmp" >"$log" 2>&1; then
mv -f -- "$tmp" "$out"
printf 'created %sn' "$out"
else
status=$?
rm -f -- "$tmp"
printf 'conversion failed; see %sn' "$log" >&2
exit "$status"
fi
The double quotes in the shell script preserve spaces and wildcard characters in filenames. The temporary suffix and process ID reduce collisions when multiple workers run. Keeping the temporary file in the destination directory makes the final mv an atomic rename on ordinary local filesystems; do not assume that property across different mounts or network filesystems.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsKeep commands reproducible
- Generate unique output names instead of overwriting a source or a previous successful result.
- Use
-nwhen a job must never overwrite an existing destination; use-yonly when an automated policy explicitly permits replacement. - Record the complete command, FFmpeg version, input path, output path and exit code.
- Send both normal diagnostics and errors to a durable log with shell redirection or a service manager’s journal.
- For batch work, place jobs in a queue and set a fixed worker count rather than starting one process per file.
Verify the output
A zero exit status is necessary but not sufficient. Check that the output exists, has a plausible size and duration, and contains the streams you intended.
test -s 'output.mp4'
ffprobe -v error -show_entries format=filename,duration,size -show_streams -of json 'output.mp4'
ffmpeg -v error -i 'output.mp4' -f null -
test -s catches a missing or empty file. ffprobe lets a script compare duration, stream count, dimensions and codecs with policy. The null output pass decodes the file without writing another video and reports decode errors. For important deliveries, open the file with the actual target player as well; a technically valid file can still expose a compatibility issue in a particular application.
Compare the output duration with the source, especially after trimming, concatenation or variable-frame-rate conversion. A suspiciously short duration, a missing audio stream or a large unexpected size is a reason to inspect the log before publishing the file.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Control CPU, memory, disk and network use
Limit concurrency
Each software encode can consume substantial CPU and generate sustained disk reads and writes. Start with one worker, measure its effect on the VPS, and increase concurrency only while interactive services retain acceptable response times. More workers can reduce wall-clock time for a batch but may increase total contention and make every job slower.
Free tools Windows power users keep installed
One-click scans. No signup required.
Keep working data local and predictable
Read from fast local storage when possible, and avoid writing a temporary file to a nearly full volume. If the input arrives over a network, download it completely or use a controlled pipe so a transient connection failure does not leave an apparently complete source. Account for egress bandwidth when uploading finished files; conversion speed is irrelevant if the destination transfer is the bottleneck.
Schedule long work
Use a service manager or queue for recurring conversions. A terminal multiplexer is adequate for an occasional interactive job, but it does not provide retries, dependency ordering or durable status. Redirect logs, set a working directory explicitly and make the service run as a restricted account with only the permissions it needs.
Do not promise a fixed frames-per-second figure from a command copied from another VPS. CPU model, virtualization limits, storage, source complexity, encoder settings and concurrent services all change throughput. Benchmark a representative clip on the actual instance before sizing a queue or selling a processing-time guarantee.
Use hardware acceleration only after verifying the VPS
Hardware acceleration is optional. It depends on the VPS exposing suitable hardware, usable drivers and an FFmpeg build containing the relevant components. A GPU or integrated-media device is not automatically faster: transferring frames between system memory and a device can consume enough time to erase the encoding benefit, and hardware encoders may offer different quality or feature controls than software encoders.
Recommended Free Tools
Discover what the build exposes
ffmpeg -hwaccels
ffmpeg -encoders | grep -E 'vaapi|qsv|nvenc'
The FFmpeg manual lists vaapi and qsv among hardware-acceleration choices. The first command shows components enabled in the current build; the second helps confirm that an encoder is present. These commands do not prove that the VPS can open the device at runtime.
VAAPI on Linux
VAAPI commonly uses a render device such as /dev/dri/renderD128. The conversion account must be allowed to open that device, and the host must provide a functioning driver. Check the device and permissions before attempting a job:
ls -l /dev/dri
id
ffmpeg -vaapi_device /dev/dri/renderD128 -i 'input.mp4' -vf 'format=nv12,hwupload' -c:v h264_vaapi -qp 23 -c:a aac -b:a 128k 'output-vaapi.mp4'
Add the account to the host’s appropriate video or render group only according to the VPS provider’s documentation and security policy, then start a new login session so group membership is applied. If the device is absent, permission is denied, or the encoder is missing, return to software encoding rather than repeatedly retrying the same command.
Intel Quick Sync and other providers
qsv is another documented acceleration path, but its availability and required device setup vary by host and FFmpeg build. Cloud GPU instances may expose a different API and encoder set. Treat such hardware as a capacity choice for sustained, high-volume workloads, not a prerequisite for a basic conversion. Validate quality, stream features, memory transfers and total job time on a representative clip before migrating a queue.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Troubleshoot common failures
“Unknown encoder” or “Encoder not found”
The installed build does not contain the requested encoder, or the encoder name is wrong. Run ffmpeg -encoders, check ffmpeg -version, and choose an encoder the build lists or install a maintained build with the needed feature.
“Permission denied”
Check read permission on every input directory component and write/execute permission on the output directory. For hardware paths, inspect /dev/dri permissions and the conversion account’s groups. Do not solve a single failed job by running the entire service as root.
The output is huge or looks poor
Review the video encoder, quality control and filters. A lower CRF value generally asks for higher quality and a larger file; a very fast preset can trade compression efficiency for speed. Confirm that a filter did not force an unintended pixel format or scale, and compare the source and output with ffprobe.
Audio or subtitles are missing
Inspect all input streams and replace automatic selection with explicit -map options. Verify that the destination container and player support the selected subtitle and audio codecs. Use optional maps only for streams that may not exist in every source.
Recommended Free Tools
The job stops when SSH disconnects
Move it into tmux, a service manager or a queue, and redirect logs. For recurring work, make the service restart policy and retry behavior explicit so a network or host interruption does not silently lose the job.
Quick Recap
A repeatable VPS conversion checklist
- Confirm the source path, destination path, account permissions and available disk space.
- Run
ffmpeg -versionand save the build information. - Inspect streams and metadata with
ffprobe. - Define the target container, video codec, audio codec, quality policy, filters and stream map.
- Run one representative conversion and inspect its log.
- Verify duration, size, streams and decodability with
ffprobeand a null decode. - For automation, quote paths, create a unique temporary output, preserve logs, check the exit status and rename only after success.
- Limit worker concurrency and monitor CPU, memory, disk I/O, disk capacity and network bandwidth.
- Test hardware acceleration separately; use it only when the VPS, drivers and FFmpeg build demonstrate a real benefit for your workload.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

