AsfBin Version 1.8.3

AsfBin is a command line utility for cutting out fragments, joining, editing and repairing ASF files. AsfBin can be applied to any ASF file, that is, not only to those with ASF extension but also those with WMV and WMA extensions. Precision, speed and the maximum fidelity was my top priorities in desing of the AsfBin software. Not to mention, of course, reliabilty of this tool.

The whole operation is performed without recompression of the whole file. On a user demand, only a couple of first samples may be recompressed to give the ultimate precision in cutting. Because of that, the video quality is not degraded and the resulting file remains as unchanges as possible.

AsfbinWin is a Windows counterpart of the AsfBin command line utility, providing the same level of functionality as Asfbin. It has an easy to use and clear user interface with powerful video preview capabilities.

In the previous versions of the result of an operation was always one media file. But since version 1.5 a -sep option was introduced to allow a user to save each selected range to a separate file. Other unique feature is the ability to recreate key frames basing on progressive ones, thus allowing to cut the video at any desired time position. Because AsfBin do not rely on ASF file index, it can skip damaged area and repair the data stream starting from first good samples.


AsfBin is an old Asfcut successor. The old application was using Windows Media Format SDK, which contained some serious bugs and limitations which I wasn't able to work around, I decided to write my own, so to say, SDK from scratch basing just on the ASF file specifitaion.
It all started long time ago, when my favourite episode of Anime was broken and I tried to repair it. Unfortunately there no tools that were able to fix it at that time. I found out that using Windows Media Format SDK from Microsft I will be able to write such an app with just no time. That is how Asfcut was born.


  • cutting fragments out of all ASF files (*.asf, *.wmv,...),
  • precise file joining,
  • repairing damaged and/or unseekable ASF files (*),
  • loseless processing,
  • creating loops,
  • ability to remove streams,
  • adjusting packet size,
  • adjusting buffer window,
  • ability to removing scripts, markers,
  • saving segments to a separate ASF files,
  • inverting selection, so you can easily point the fragment to be deleted,
  • adding markers and commands,
  • delaying selected streams (not necessarily audio streams),
  • printing out information on key frames location and index entries,
  • control over the type of indexing,
  • cutting fragments adjusted precisely to key frames locations,
  • optimizing packet size,
  • debugging ASF files,...

*) For all people who could not repair or process their asf files:
If you tried all possible ways using AsfBin and the tool couldn't do what you needed, or it just simply crashed, go to the AsfBin Bugs section. There you can find latest release information and maybe the issue is already described there. You will find out how to contact me, so I could get the problematic file and work on how to improve AsfBin.

This tool is FREE for non-commercial use.
If you want use it for business purposes, please proceed to a Licencing section.

Back to top

What's new in version 1.8.3

  1. Improved precision of resulting file duration when joining many files together.
  2. Added support for UTF-8 text files when importing markers, scripts and attributes. With this improvement any languages like e.g. Japanese, Arabic can be used when adding markers, scripts or when setting file attributes.
  3. AsfBin can fix files that were having incorrect entries in the metadata object preventing it from playing by major video players.

What's new in version 1.8.2

  1. Removed "Human test".
  2. Fixed the out-of-memory issue when processing files over 2GB in size having a script command stream in it.

What's new in version 1.8.1 (Windows version)

  1. Fixed Attributes setting dialog.
  2. Markers and Scripts dialogs which were completely broken (what was set wasn't written to the output file) are now fixed.
  3. Annoying "feature" that caused closing AsfBinWin when Enter key was hit is fixed.
  4. Corrected check of writing to the same file as one of input files.
  5. Warning that was shown when allegedly precise copying was not possible is fixed.

What's new in version 1.8.0 (Windows version)

  1. Finally added preview window allowing you precisely select times when editing should take place. The are multiple ways of selecting time:
    • keys (arrows, page up/down, home/end)
    • mouse
    • speed modifiers (hold Shift and/or Control keys to modify the behaviour)
    Preview allows you to select which video stream to view and can snap time to an exact frame presentation time.
  2. All path inputs are equipped with AutoComplete feature speeding up the process of typing path (input/output paths). You can still use the Browse button to open the standard Open/Save dialog.
  3. Most of the crucial controls have Tooltips associated explaining how to use them.
  4. Range slider, allowing you to select time ranges within selected files nicely shows you by using different colors where each file, constituting the virtually connected file, starts and ends.
  5. Ability to invert selected ranges by just one button click.
  6. Advanced setting dialog simplified.
  7. Logging capability added. You can select one of 3 available verbosity levels when writing to the log file.
  8. You can load and save Script Command to and from external file.
  9. You can load and save Markers to and from external file.
  10. When precise recompression is not possible due to missing codeds warning signs are shown (with associated tool tips).
  11. Preview window position can be snapped to the main window edges.

What's new in version 1.7.14

  1. Corrected issue with processing over 4GB files.
  2. Corrected problem with scripts not beeing copied from the original file if copying range was not specified.
  3. Corrected the issue with the script samples distance limitation that was set to 65s. Now it can be unlimited.

What's new in version 1.7.1

  1. Totally rewritten sample packing algorithm so even multiaudio files with no video are packed optimally. This will also fix problems with files containing script commands and some issues with streaming ASF files via Windows Media Server.
  2. Finally added DMO support when recompressing video. By using one of two new switches -vcm and -dmo a desired technology can be selected. By default it is VCM.
  3. Added -infohdr switch to show all info from ASF header.
  4. Added -optps switch that calculates the optimal size of the packet to minimize data padding.
  5. Corrected timing of script commands and markers stored in the header after cutting out fragments from an original file when actual start time differs from demanded time due to distand key frame location.
  6. Removed size limitation of record data in metadata objects in header.

What's new in version 1.6.1

  1. The total file size info kept in the ASF header was not properly updated. This resulted in lack of seeking possibilities when streaming processed file via Windows Media Server.
  2. Bug connected with processing files containing script command stream corrected. The total time spread of all samples gathered in a single packet could go beyond 65536 ms, what was against ASF specification.
  3. Asfbin was losing last script command sample. This bug is corrected in this version.

What's new in version 1.6

  1. FINALLY! After 3 years! Solved the mistery behind the old tape effect in the Windows Media Player - defeated buggy jitter correction algorithm in the MS WMPlayer produtcs! It was possible by adding audio decompression feature to asfbin and thus real sample duration measurement became possible. An advanced junction optimization algorithm was implement resulting in smooth connections between audio tracks of joined ASF files.
  2. Added new switches allowing to set creation time of a resulting file to the time of the source file properly corrected by the start time offset (-act). Second related switch is -nots which causes all sample times remain as in original files.
  3. Added possibility to process files still recorded by live stream recording software or WMS archive plugin. Other corrections was made in order to repair almost all cases of damaged files.
  4. Optimized file processing. Time spared thanks to those optimizations is used to calculate precise audio junctions (this needs some audio samples to be uncompressed).
  5. Some minor issues with segment cutting and joining were corrected.
  6. Thousands of tests was performed to find and correct any existing bugs.

What's new in version 1.5

  1. New quality in cutting ASF files! AsfBin is capable to cut files at any position with the accuracy to one video frame regardless there is a key frame or not, while maintaining maximum fidelity to the original. To enable this feature use -rkf switch. This is not enabled by default because so far not all video formats are supported.
  2. To perform system configuration check in order to enable as many codecs as possible for AsfBin use -cfg switch. AsfBin performs this check anyway, but only once for given Windows configuration.
  3. Improved recovery of damaged ASF files.

What's new in version 1.1

  1. Ability to save each segment to a separate ASF file using -sep switch.
  2. Inverting selection, so you can easily point the fragment to be deleted.
  3. Adding markers and commands specified by a text file.
  4. Delaying selected streams (not necessarily audio streams). Information on stream numbers can be obtained by using -info switch.
  5. New version can list all key frames with their time time location. This allows to select more precisely the cutting time of segments.
  6. Control over the type of the created index. New switch -sionly and improved -forceindex.
  7. A new switch -ebkf causes a fragment to end precisely just before the next key frame.
  8. Major improvements in parsing engine as I received a number of ASFs which couldn't be repaired by the version 1.0.3, so I was able to corrent problems and finally make a new asfbin be able to repair them all. Of course some files were so damaged that even with an expert support it could be hard to do this, if possible at all.
  9. Speed improvements especially for improperly build ASF files.
  10. Code review also unveiled quite many bugs that wasn't reported yet.

What's new in version 1.0.3

  1. Improved packet data repair routines. Some damages (1-3 bytes long) withing packet or sample data can be repaired.
  2. Improved searching for time range withing data packets when some packets are damaged or not conforming ASF specification.
  3. Removed bug causing script commands not to be written.
  4. Correcting bug causing bad padding data handling. Speeding up packets reading.
  5. Other improvements of data packets reading.
  6. Improved header reading routines. Asfbin is much more error-proof when it comes to header parsing.
  7. Asfbin can now index files larger than 4GB.
  8. When connecting a file with the script commands or markers with a file having no such objects, asfcut was crashing. This bug is removed.

What's new in version 1.0.2

  1. Major Win95, 98, Me incompatibilities fixed. The function for opening files were Unicode version only. That caused no input file could be opened by asfbin in the Win9x. That proofs clearly that asfbin 1.0.1 wasn't "strongly" tested under Win9x enviroment. ;-)
  2. Major improvements in a header parsing code. Now some errors in the header will cause only minimal loss of data.
  3. Code review detected many weak points, where application might crash.
  4. Limit to pack only one audio sample in a packet was removed. The limit was introduced because some players were loosing audio when playing resulting files. And I supposed that the lack of this limitation was causing such a behavior. It was not true. Also processing of some files could be very slow.
  5. Files with empty streams (with no samples in it) were processed terribly slow. This bug is already removed.
  6. Removed a bug connected with indexing of files having hidded streams.
  7. When removing a stream the information on bitrate mutual exclusion wasn't updated. Now it is correct.
  8. In some very rare case packets were built inefficiently breaching ASF specification. Also for some very large packet sizes, payload count could overflow the limit of 64 payload per packet. Already correct.

What's new in version 1.0.1

  1. Corrected minor bug in the displaying duration of processed segments. The on-screen message said alway that duration was to the end. The output files weren't affected by this bug.
  2. Corrected bugs when reading segments from segments file.
  3. Corrected bug cousing file not to be written when the first sample time was smaller than the preroll time.
Back to top


asfbin [INPUT MEDIA FILES] -o <out_file> [SWITCHES]

[INPUT MEDIA FILES] can be set as follows:
-i <infile> <infile> is an input windows media file.
Switch -i can be repeated many times. E.g.:
asfbin -i test01.asf -i test02.asf -i D:\video\append\test03.asf -o joined.asf
-l <in_file_list> <in_file_list> is a file containing list of file paths to join. List file is a text file containing subsequent files to join/cut. E.g.:
All files have to be of the same video and audio format!
-sep Write each segment to a separate file. Output file name will be treated like a name template where all occurences of {000} or {  } are replaced by the segment number. If {0} is not present, a number will be inserted right before the file name extension. E.g. "MyName0001.asf". "{000}" is replaced by e.g. "001", and "{   }" is replaced by "  1".
-s <segments_list> <segments_list> file containing list of segments to extract,
-a <attrib_list> (or -attr) file containing list of attributes to set.
-m <marker_list> (or -markers) <marker_list> is a name of a file containing a list of markers to set.

Each line of this file should consists of a pair:
<time> <marker text>
0:00:45 The fourty fifth second.

Allowed time formats are explainded below.
-k <script_list> (or -scripts)
<script_list> is a file name containing a list of scripts to set.
Each line of this file should consists of:
<time> <type> <command>
15 URL

This script command will cause that at 15th second a default internet browser will run with a url set to Apart from the "URL" type, there is also other type of command supported by WMP, namely "FILENAME". This causes WMP to open a specified file after reaching specified timestamp.

Allowed time formats are explainded below.
-cfg (or -config) Forces codecs configuration check. By default AsfBin performs it only once on a given system.
-start <times> Starts copying from specified time.
-dur <times> Copies segment of specified time, these two switches can be repeated many times, each pair defining a new segment to extract.
-stop <times> (or -end)
Stops copying at specified time.
-invert (or -invertsel, -invsel)
Inverts selection. Specified segments will be removed.
-repeat <n> Repeats the entire resulting file times.
-istart Doesn't wait for key frame. Files are joined without any advanced fitting. Can be used for files previously cut. By default copying starts after finding a key frame.
-cvb Copies very beginning of an input file discarding even finding key frame when joining too or more files.
-brkaud (or -breakaudio, -ba)
Audio streams junctions will be marked as gap. Since version 1.6 this option is turned off by default. If still some problems with audio are experinced when playing with MS WMPlayer (any version) then please turn this option on. Other players like Media Player Classis are free from this bug.
-brkvid (or -breakvideo, -bv) Video streams junctions will be marked as gap. This option may be usefull when joining two files encoded by slightly different versions of codec what may cause artefacts appear on segment junctions.
-ebkf Streams will end before nearest past key frame.
-uniq (or -unique, -u) Makes resulting files unique by changing original ASF file identificators into unique ones. May be useful when using playlist capability of Windows Media Player which appears to take into consideration only this ID when distinguishing media files.
-act (or -aft) Adjusts creation time of the file to the time of creation of the original file plus start time.
-nots Leaves sample times and packet times unchanged.
-rkf (or -recreatekf) Enables a single frame accuracy by turning on recreation of key frames whenever it is necessary. This mode does not guarantee correct results. While it is highly likely that WMV3, MP42 and MP43 video formats will be correctly handled, all other formats will not be probably recognized,
-dmo Forces using DMO when recompressing video samples (in a current version DMO is used by default).
-vcm Forces using VCM when recompressing video samples.
-noindex Doesn't index output file.
-forceindex Forces writting advanced index.
-sionly Simple index only.
-nomarkers Doesn't copy markers.
-noscripts Doesn't copy script command.
-nostr <numbers> (or -nostream,
-excludestr, -exclstr, -removestr)
doesn't copy selected streams. <numbers> are stream numbers separated by space or comma. This switch can be used many times.
-q Quiet mode - only few information are presented.
-v Verbose mode - turned on by default.
-details Stronger verbose mode - shows many details about copying process, among other things key frames.
-debug Strongest verbose mode - debug mode.
-y Overwrites without asking.
-bw <milliseconds> Forces setting of the initial play delay. This value has direct impact on the internal bucket size. Selecting too small value may cause sample losing.
-ps <bytes> Forces size of data packets.
-optps <bytes> Calculates optimized packet size to minimize data padding.
-rmgaps Big time gaps are removed(*) *)This option is not yet active!
-adelay [-] <time> Delays audio streams by the a specified time. The time value can be negative.
-sdelay <number> [-] <time> Delays selected stream by a specified time. The time value can be negative.
-info Just shows information on input sources.
-infokf Just shows information on input sources and locations of key frames in selected time range.
-infohdr Shows detailed information on an input ASF file header.
-infoidx Shows detailed information on indices appended to a processed file. Add -details switch to get additional information on any eventual errors.
-h Shows asfbin usage explanation.

<time> in general is given in seconds, but it accepts following formats as well:
1:59:45.35 = 1 h, 59 min, 45s, 35 hundredths, 3:30 = 3 min, 30 sec.,
1023.101 = 1023 sec. and 101 thousandths, etc.

Back to top

Examples of usage:

  1. To join two ASF files into one big please type:
    asfbin -i first.asf -i second.asf -o big.asf
  2. To cut out a fragment from a bigger ASF file please type:
    asfbin -i big.asf -o part.asf -start 10:03.045 -duration 30.01

  3. To cut some fragment from a file that begins in the middle and lasts to the end of file simply give only -start parameter without duration.
    asfbin -i big.asf -o endpart.asf -start 5:45

  4. To extract two segments from one bigger ASF file and put in a one file please type:
    asfbin -i big.asf -o smaller.asf -start 1:15 -dur 4:00 -start 10:15 120

  5. To join many ASF files into one big You can also use input file list:
    asfbin -l files.lst -o bigone.asf

  6. To work on the list of ASF files like on the one big file and to cut some fragments from it, please specify:
    asfbin -l files.lst -o parts.asf -s segments.lst

  7. To delay audio stream by 350ms type:
    asfbin -i input.asf -o output.asf -adelay 0.35

  8. To advance stream number 4 by 250ms type:
    asfbin -i input.asf -o output.asf -sdelay 4 -0.25

  9. To join two ASF files into one big please type knowing that the second file may contain progressive frames that are a continuation of the first file, type:
    (E.g. your encoder software may save streams in segmented file, each of size 50MB. In that case using -cvb may be helpful.)
    asfbin -i first.asf -i second.asf -o big.asf -cvb

  10. To remove low bitrate audio and video streams assuming that those are respectively streams number 1 and 3, invoke command:
    asfbin -i input.asf -o output.asf -nostr 1,3

  11. To extract 10 time ranges from the long input file and save them under names: short01.asf, short02.asf and so on, assuming that time ranges are kept in timeranges.txt file, invoke the command below. We also want each file to be unique.
    asfbin -i long.asf -l timeranges.txt -sep -o short{00}.asf -unique

  12. To print out the information on precise location of all key frames in the input file please run:
    asfbin -i input.asf -infokf

  13. To repeat a selected time range two times please run the command:
    asfbin -i test.asf -o big.asf -start 10 -dur 15 -repeat 1

  14. To print out the information on index entries in the input file please run:
    asfbin -i input.asf -infoidx -details > some.log

  15. If you want to divide file into several segments, send it via e-mail or in any other way and then join it together with no losses follow the instructions:

    asfbin -i large.wmv -o partA.wmv -y -start 0 -dur 10 -ebkf
    asfbin -i large.wmv -o partB.wmv -y -start 10 -dur 10 -ebkf
    asfbin -i large.wmv -o partC.wmv -y -start 20 -dur 10 -ebkf
    asfbin -i large.wmv -o partD.wmv -y -start 30 -dur 10 -ebkf

    and join it together again:

    asfbin -i partA.wmv -i partB.wmv -i partC.wmv -i partD.wmv -o large.wmv -y -istart

Radioactive Pages presents:  
Get Microsoft Silverlight
Radioactive Software... a small gear in Your Company's engine.
English Language   English
Polish Language   Polish