Convert ASF File to MP4 with FFmpeg: Commands and Fixes

November 25, 2026 · RenderIO

The advice you'll find in most threads is one line: ffmpeg -i input.asf -c copy output.mp4. It's also the line that fails most often. Stream copy doesn't convert anything, it repackages packets, and when those packets carry Windows Media Video or Windows Media Audio the MP4 muxer either refuses them or writes a file that plays on your laptop and nowhere else.

Converting an ASF file to MP4 is a reading job before it's a command job. The header lists every stream, its codec, the metadata and any protection objects, and that list picks your path: a lossless remux, a targeted re-encode of the audio or the video, or a full stop on a file you don't yet have the rights to process. Skip the read and you're guessing with a 400 MB asset.

Every path below ends the same way, with a probed and played MP4 rather than a file that merely exists.

Table of Contents

Inspect Your ASF Streams and Choose Remux or Transcode

Run ffmpeg -version and ffprobe -version before anything else. Those two lines confirm the build you're working with and give you a version string to paste into a job log later. Every command here runs on FFmpeg 4.0 or later.

Then probe the source: ffprobe -v error -show_streams -show_format input.asf. Read codec_name on each video and audio stream, plus width, height, frame rate, pix_fmt, channel layout and duration. Count the streams rather than assuming one video and one audio, because an ASF header can declare a second audio track, a marker or script stream, or audio with no video behind it. If the output looks like noise, the ffprobe tutorial on reading stream data walks the fields one at a time.

Microsoft's ASF overview makes the same point from the format side. The header carries the stream list, the codec identifiers, metadata and content-protection fields, so the filename extension tells you nothing about what's inside. ASF was built to hold Windows Media Audio, Windows Media Video and VC-1, as the Library of Congress format record sets out, and that record dates the specification's final revision to December 2004, after a public release back in February 1998. A container frozen in that era carries codecs from that era.

Match the probe to a method

Every row below is a real outcome you can hit behind the same .asf extension. Find yours and run the command it names.

Stream found in ffprobe Method Re-encodes Expected result
H.264 video and AAC audio Stream copy with -c copy No Finishes in seconds, lossless
H.264 video and WMA audio Copy video, transcode audio to AAC at 128 kbps Audio only Fast, video quality unchanged
WMV or VC-1 video with WMA audio Transcode to libx264 at CRF 18 to 23 and AAC Yes Slower, small quality loss, broad playback support
WMA audio only, no video stream Extract audio with -map 0:a:0 -vn -c:a aac output.m4a Audio only Small audio file, no video track
Any stream with DRM or license objects Stop and confirm access and license Nothing, the job stops No conversion until lawful access is confirmed

MP4 is a standardized container, not a promise of any particular codec pair. Its ISO history runs from the 2001 first edition through MPEG-4 Part 14 in 2003 and later editions in 2018 and 2020, as the record of MP4 file format milestones documents. The standard tells you how timed data gets boxed. It doesn't tell you which codec every player will unpack.

Two files, two decisions

Take a source where v:0 reports codec_name=wmv3 at 720x480 with pix_fmt=yuv420p and 29.97 fps, and a:0 reports codec_name=wmav2, 2 channels at 44.1 kHz. That lands on the transcode row. Neither stream is legal inside MP4, so -c copy either fails outright or produces something only a desktop VLC will open.

Change one variable and the job changes with it. A file with v:0 codec_name=h264 and a:0 codec_name=wmav2 is a video copy plus an audio transcode: the picture transfers untouched, while the audio gets decoded and re-encoded as AAC. When a:0 reads aac, the whole thing goes through as a stream copy.

The trade-off in one line: copy finishes in seconds with zero generation loss, transcode burns CPU time and a little quality to buy playback in browsers, phones, editors and social platforms.

Two checks belong before you commit. Compare the probed duration against the duration the source should have, because a short read points at a truncated file rather than a bad command. Then look for protection or licence objects in the header and treat those as a stop, not an error to retry, until lawful access is confirmed. Name the method out loud, then type the command.

How to Convert ASF to MP4 with FFmpeg Step by Step

The stream list already chose the method. What remains is execution: one remux attempt, one careful read of the error, one transcode with flags you can defend line by line.

A three-step infographic showing how to convert ASF video files to MP4 format using FFmpeg commands.

  1. Try the remux first when the probe showed H.264 and AAC. One command: ffmpeg -i input.asf -map 0:v:0 -map 0:a? -c copy -movflags +faststart output.mp4. The -map 0:v:0 takes the first video stream and -map 0:a? takes audio only when it exists, so no stray data track rides along into the output.

  2. Read the error before you change anything. If the remux stops with codec not currently supported in container, the MP4 muxer declined a Windows Media stream. That is the file talking, and retrying the same command changes nothing.

  3. Switch to the compatibility transcode. ffmpeg -i input.asf -map 0:v:0 -map 0:a? -c:v libx264 -preset medium -crf 20 -pix_fmt yuv420p -c:a aac -b:a 128k -movflags +faststart output.mp4. Same mapping, real encoder settings this time. The command leaves the Windows Media container described in Microsoft's ASF documentation) and targets H.264 plus AAC, the pair browsers, phones and editors all accept.

  4. Keep -pix_fmt yuv420p in the command. Devices and browsers that reject 10-bit or 4:2:2 chroma play yuv420p without complaint. Dropping this flag is the usual reason an MP4 looks fine on a desktop and shows a black rectangle on a phone.

  5. -movflags +faststart rewrites the index to the front of the file. Playback can start before the whole download finishes, which matters for anything served over HTTP. It costs one extra write pass over the output at the end of the run.

  6. Pick CRF by content, not by habit. Use 18 for film, grain or detailed footage, 23 for talking heads and screen recordings. A lower number means higher quality and a larger file. The -preset medium default is where encoding time and file size stop arguing, and slower presets shrink the output at the same CRF if CPU time is cheap.

  7. Handle the tracks the default mapping misses. For a second audio track, swap -map 0:a? for -map 0:a:1. For audio-only ASF, drop the video mapping entirely and run ffmpeg -i input.asf -map 0:a:0 -vn -c:a aac -b:a 128k output.m4a, because -map 0:v:0 matches nothing when the header lists no video stream.

  8. Keep FFmpeg's log. The banner names the version, the stream mapping lines show which tracks were selected, and the closing size and bitrate lines show what was written. That is what a batch record or a bug report needs.

Set these once per job and stop tuning by feel:

Option What it controls Starting value
-i input.asf Input file input.asf
-map 0:v:0 -map 0:a? Selects first video and optional audio stream Keep as written
-c copy Copies streams without decoding or re-encoding Remux only
-c:v libx264 Encodes video as H.264 libx264
-pix_fmt yuv420p Uses a pixel format most devices accept yuv420p
-crf Quality target, lower means higher quality and larger file 20 (18 to 23 range)
-c:a aac -b:a 128k Encodes audio as AAC at 128 kbps 128k
-movflags +faststart Moves MP4 metadata to the start of the file +faststart

Rate control deserves more room than a table cell gives it. CRF, preset and explicit bitrate each suit different kinds of archive, and the trade-offs between them get a fuller treatment in this guide to encoding video to H.264 with FFmpeg.

Run the commands from a terminal opened in the folder that holds the files, and leave the original ASF untouched. For a whole directory, wrap the transcode in a shell loop rather than retyping it: for f in *.asf; do ffmpeg -i "$f" -map 0:v:0 -map 0:a? -c:v libx264 -preset medium -crf 20 -pix_fmt yuv420p -c:a aac -b:a 128k -movflags +faststart "${f%.asf}.mp4"; done. One pass converts every file and keeps the sources intact beside the outputs.

If you'd rather watch the sequence than read it, this walkthrough runs the remux and the transcode back to back.

Verify the MP4 Before You Trust It

An exit code of 0 means FFmpeg finished writing. It doesn't mean the output has every stream, the full duration, or a picture that plays anywhere other than your laptop. Treat a created file as a draft until it passes a check.

An infographic advising users to verify converted MP4 files by using ffprobe and comparing with originals.

Work through this list on every file that matters:

  • Streams: probe the output and confirm every intended video and audio stream is present, not just the first one.
  • Duration: compare output against input. A second of difference is normal container overhead; minutes are not.
  • Audio: check that an AAC stream exists, and that its channel count and sample rate match what you expected.
  • Picture: confirm the video reads h264 with yuv420p.
  • Playback: play the first minute and a segment from the middle, and listen for lip sync while you scrub.

A ten-minute source that becomes a six-minute MP4 is a truncated file, not a bad command. No flag repairs it.

For a high-value asset, decode the whole thing before you trust it: ffmpeg -v error -i output.mp4 -f null - reads every frame, writes nothing, and reports decode errors on stderr. That's cheaper than discovering the problem in a publish queue.

No universal success rate is defensible here, because the outcome depends on codec support, file corruption, DRM and timestamp quality, and any percentage quoted for this job is invented. Keep the original, the FFmpeg version and the exact command in a log so you can reproduce a good result and diagnose a bad one. The failures you can fix with a flag are covered below; the one you can't is a damaged source, which needs a better copy, not another run.

Common FFmpeg Errors and How to Fix Them

The error you'll meet most is codec not currently supported in container, and it means exactly what it says: a Windows Media stream was copied into MP4. Drop -c copy and transcode. The rest of the list is short, and each symptom points at a single change.

Symptom Likely cause Fix
codec not currently supported in container Windows Media stream copied into MP4 Drop -c copy and run the transcode command
No sound in output Audio not mapped or an unsupported codec Add -map 0:a? and -c:a aac -b:a 128k
Audio drifts out of sync Damaged timestamps Read the stderr log, re-encode, avoid timestamp-reset flags
Output shorter than input Truncated or partly readable ASF Compare durations and try another copy of the source
Output will not play on phones High bit depth or unusual pixel format Add -pix_fmt yuv420p
Input will not open or decode DRM or license protection Confirm lawful access and license before retrying

Missing sound is a mapping problem far more often than a codec problem. The 0:a? syntax fails when the audio stream index differs from what you assumed, and re-running with -map 0:a:0 confirms it in seconds.

Drift is a different animal. Damaged timestamps in the source produce audio that starts in sync and slowly slides, and reading FFmpeg's stderr is the only way to see the discontinuity. Re-encode rather than copy, and resist blanket timestamp-reset options, because they hide the discontinuity instead of repairing it and can cause the drift they promise to cure.

A file that won't open at all is the one worth stopping for. ASF supports Microsoft content-protection objects that can require a licence and a cryptographic key before playback, and Microsoft's guidance on reading DRM-protected ASF files frames that as a rights question rather than a decoding one. A file that played in an old authorized Windows environment can fail in a modern pipeline for reasons no flag touches. Confirm lawful access to the licence and the source, then test decoding on a short clip before committing a batch. No legitimate converter bypasses DRM.

When two formats look interchangeable and behave nothing alike, the guide to video codec support explains which containers accept which streams. Most of these fixes take minutes; the truncated-source row takes a new file.

Pick Your Conversion Path for the Archive

The stream list decides the per-file job, and the file count decides the workflow around it. For one file or a handful, stay local: probe, run the matching command, verify, move on. Nobody needs a pipeline for five files.

For a folder of hundreds, sort before you convert. Probe every file, write the results to a CSV, and bucket them into remux, transcode and blocked. Convert each bucket with its own command and its own log line recording the FFmpeg version, the command as executed and the probe of the result. Write outputs to a new folder and leave every original ASF in place, because the source is the only copy you can't regenerate.

A conceptual diagram showing two workflows for processing ASF files: quick single-file exploration versus team-based automated pipelines.

Audio-only ASF files are common in old archives and never need the video branch. When the main task is getting a pile of WMA recordings into something playable, you can convert audio files online and skip the terminal entirely.

If maintaining FFmpeg builds, watch folders and a job queue is the part you'd rather not own, RenderIO runs FFmpeg commands over HTTP in a sandbox and returns the output file and its metadata, with full stderr when a job fails.

Start smaller than you think you should. Probe one real file today, pick its row in the table, convert that single file and verify it before you point anything at a folder.


RenderIO is built for exactly this loop at scale: send an FFmpeg 7.x command over HTTP with your ASF input mapped in, and get back the converted MP4 plus the stderr you need to debug the odd file. The same command you tested locally becomes a repeatable API call, with MP4, MKV, MOV, H.264, H.265, AAC and the rest of the standard codec set available in the build. Point your first batch at RenderIO and keep the probe-verify habit rather than the desktop converter.