How to do things
AI Noob vs. Pro

List biggest files
List newest files
Show subdir sizes
Search in files
Replace word in files
List dir differences
Send files in LAN

Free Open Source:

Swiss File Knife

a command line
multi function tool.

remove tabs
list dir sizes
find text
filter lines
find in path
collect text
instant ftp or
http server
file transfer
send text
patch text
patch binary
run own cmd
convert crlf
dup file find
md5 lists
fromto clip
hexdump
split files
list latest
compare dirs
save typing
trace http
echo colors
head & tail
dep. listing
find classes
speed shell
zip search
zip dir list

Depeche View
Source Research
First Steps

windows GUI
automation

command line
file encryption

free external tools,
zero install effort,
usb stick compliant:

zip and unzip
diff and merge
reformat xml
reformat source

cpp sources

log tracing
mem tracing
hexdump
using printf

articles

embedded
stat. c array
stat. java array
var. c array
var. java array
view all text
as you type
surf over text
find by click
quick copy
multi view
find nearby
fullscreen
bookmarks
find by path
expressions
location jump
skip accents
clip match
filter lines
edit text
highlight
load filter
hotkey list
receive text
send in C++
send in Java
smooth scroll
touch scroll
fly wxWidgets
fly over Qt
search Java

Supersonic Text File Search - Free Download

Cut or extract parts from Mpeg2 video files on the command line, by specifing byte positions, with free open source tools for Windows, Mac OS X, Linux and Raspberry Pi. Mark sections interactively by VLC media player and use exported bookmarks directly for cutting in SFK. Also find an article about PVR example hardware here.
  • Download the free Swiss File Knife Base from Sourceforge.
  • Open the Windows CMD command line, Mac OS X Terminal or Linux shell.
  • OS X : type mv sfk-mac-64.exe sfk and chmod +x sfk then ./sfk
  • Linux: type mv sfk-linux-64.exe sfk and chmod +x sfk then ./sfk. OS X and Linux syntax may differ, check the help within the tool.
sfk media infile.mpg -keep n1-n2 -cut n3-n4 -tofile out.mpg
sfk media infile.m3u -keepbook -tofile out.mpg
sfk list mydir .m3u +media -keepbook -to outdir\$base.mpg

cuts mpeg2 video or other binary file(s), by keeping or
dropping parts given as absolute byte positions in the file.

this command is deprecated. use instead: sfk video

sfk media does not interpret, decode or encode any video data,
and knows nothing about the file format. it simply copies
blocks of bytes, which may or may not work, depending on the
file format (mpeg2 is best), media player (VLC is best) and
installed codecs of the operating system. This command is
not suitable for mpeg4 or any format using file headers.

Splitting or reducing an mpeg2 file usually keeps the result
playable in media players. Joining multiple mpeg2 files into
one file strictly requires post processing by ffmpeg,
to recalculate PCR time stamps required for playback.

parameters for cutting and post processing
  -keep n1-n2   keep this part of the file, from byte offset n1
                until before n2 (excluding offset n2), and cut
                everything before and after. keep must be given
                before any "cut" parameters.
                n1 means an absolute byte position like 12345.
                one "keep" can be followed by multiple n-n.
  -cut n1-n2    cut this part. multiple cut parameters can be
                given, and they can refer to an area within
                a "keep" range.
  infile.m3u    use a VLC player bookmark file instead of
                specifying file and positions manually.
                takes only the last entry in that file.
                file must contain an even number of start/end
                positions of sections to keep.
  -keepbook     only with .m3u files: keep all parts
                marked by a bookmark at start and end of part
  -joinraw      join all input files or parts into one output.
                with mpeg video, the output file will NOT work
                correctly in players due to wrong timestamps
                and therefore requires post processing like:
                ffmpeg -i in.mpg -target pal-dvd -c copy out.mpg
                (without -target, the output will have no sound)
  -fix parm     create a temporary file (with -tmp in filename)
                then run ffmpeg to fix the output file by re-
                rendering timestamps. "parm" is passed to ffmpeg
                as is, except for two special values which are
                extended like:
                   pal-dvd  = -target pal-dvd  (for pal output)
                   ntsc-dvd = -target ntsc-dvd (for ntsc output)
                use -fix "" to pass no extra parameters.
                requires ffmpeg 1.2 in the PATH.
  -keeptmp      keep temporary files produced by option -fix.
                default is to clean them up.
  -joinfull p   run joinraw and -fix p in one go. required to
                produce mpeg2 video suitable for playback.
  -tmpdir d     specify a folder to use for temporary files,
                and create unique filenames within.
  -keepall      keep whole content of input file(s). used only
                with -joinraw.

note:
   - all output files are overwritten without asking back,
     including temporary files. check the simulation output.
   - check free disk space by "sfk space" before processing.
     options -fix or -joinfull will use double disk space.

general options
   -tofile f     write output to a single file with name f
   -to outmask   write multiple input files to output names
                 given by a mask, like -to outdir\$file
                 "sfk help opt" for details.
   -movesrcto x  after processing, move every video input file
                 to an output folder x. move is done by rename,
                 so x must be on same file system as input.
                 if an output file of same name exists already
                 then add option -force to overwrite.
   -yes          really create or overwrite output file
   -quiet        do not show progress indicator
   -quiet=2      or =3 tells even less
   -verbose[=2]  tell more details about what is done

recommended process for video cutting
   1. download the VLC media player installer,
      run the tool and open an mpeg2 .mpg file.
   2. select Playback / Custom bookmarks / manage (CTRL+B).
      for every section to keep, create a bookmark
      at the start and end of that section.
   3. make sure there is an even number of bookmarks.
   4. select Media / Save Playlist (CTRL+Y), select file type
      M3U (not m3u8) and save, e.g., to cut01.m3u
      (if you used the VLC installer, it will remember M3U
       as the preferred export type.)
   5. sfk media cut01.m3u -keepbook -tofile out.mpg
      with .mts files and ffmpeg in your path, try instead:
      sfk media cut01.m3u -keepbook -tofile out.mts -fix ""
   6. if you process further files in the same VLC session,
      the M3U files may contain references to many files,
      but only the last (newest) entry is used.

see also
   sfk partcopy  - copy a single part of a file
   sfk space  - tell free disk space available
                   in current or given directory d

web reference
   http://stahlworks.com/sfk-media

examples
   sfk media in.mpg -keep 100000-200000 -cut 150000-160000
    -tofile out.mpg
      keep area from offset 100000 to 200000 (with a length
      of 100000 bytes) except for 10000 bytes inbetween.

   sfk media in.mpg -keep 120578-301436 518297-783591
    -tofile out.mpg
      keep the two sections and drop the rest.

   sfk media in.m3u -keepbook -tofile out.mpg
      keep areas listed in the bookmark M3U file.

   sfk select mydir .m3u +media -keepbook -to out\$base.mpg
      execute all .m3u files from mydir, write output
      files to a folder out, with the same relative name
      as the input .M3U, but with an .mpg output extension.

   sfk select n:\dvd1\part1.vob n:\dvd1\part2.vob
    +media -joinraw -tofile out.mpg
      join two .vob files into one out.mpg without any
      modifications. out.mpg will need post processing
      before it can be used in a media player.

   sfk sel -sort d:\ .vob +media -joinfull pal-dvd
    -tofile out.mpg -tmpdir c:\tmp
      join all .vob files of a PAL dvd, sorted by name,
      into one out.mpg and call ffmpeg to fix timestamps.
      uses a temporary file in c:\tmp.

   sfk sel -sort d:\ .vob +media -joinfull
    "-target pal-dvd -map 0:0 -map 0:2"
    -tofile out.mpg -tmpdir e:\tmp -keeptmp
      similar to above, but explicitely passing several
      parameters to ffmpeg, selecting dvd output and to
      mix channels 0:0 (e.g. video) and 0:2 (e.g. an
      audio track with alternative language). temporary
      file is stored on another drive and kept, in case
      post processing fails and must be done manually.
 
sfk media infile.mpg -keep n1-n2 -cut 
                       n3-n4 -tofile out.
                       mpg
sfk media infile.m3u -keepbook -tofile 
                       out.mpg
sfk list mydir .m3u +media -keepbook -to 
                      outdir\$base.mpg

cuts mpeg2 video or other binary file(s), 
by keeping or dropping parts given as
absolute byte positions in the file.

this command is deprecated. use instead: 
sfk video

sfk media does not interpret, decode or 
encode any video data,
and knows nothing about the file format. it 
simply copies
blocks of bytes, which may or may not 
work, depending on the
file format (mpeg2 is best), media player 
(VLC is best) and installed codecs of the
operating system. This command
is
not suitable for mpeg4 or any format 
using file headers.

Splitting or reducing an mpeg2 file usually 
keeps the result playable in media players.
Joining multiple mpeg2 files into one file
strictly requires post processing by ffmpeg,
to recalculate PCR time stamps required
for playback.

parameters for cutting and post processing
  -keep n1-n2   keep this part of the file, 
                from byte offset n1 until
                before n2 (excluding offset
                n2), and cut everything
                before and after. keep must
                be given before any "cut"
                parameters. n1 means an
                absolute byte position like
                12345. one "keep" can be
                followed by multiple n-n.
  -cut n1-n2    cut this part. multiple cut 
                parameters can be given,
                and they can refer to an
                area within a "keep" range.
  infile.m3u    use a VLC player bookmark 
                file instead of specifying
                file and positions manually.
                takes only the last entry
                in that file. file must
                contain an even number of
                start/end positions of
                sections to keep.
  -keepbook     only with .m3u files: keep 
                all parts marked by a
                bookmark at start and end
                of part
  -joinraw      join all input files or 
                parts into one output. with
                mpeg video, the output file
                will NOT work correctly in
                players due to wrong
                timestamps and therefore
                requires post processing
                like: ffmpeg -i in.mpg
                -target pal-dvd -c copy out.
                mpg (without -target, the
                output will have no sound)
  -fix parm     create a temporary file 
                (with -tmp in filename)
                then run ffmpeg to fix the
                output file by re-
                rendering timestamps.
                "parm" is passed to ffmpeg
                as is, except for two
                special values which are
                extended like:
                   pal-dvd  = -target 
                   pal-dvd (for pal
                   output) ntsc-dvd =
                   -target ntsc-dvd (for
                   ntsc output)
                use -fix "" to pass no 
                     extra parameters.
                requires ffmpeg 1.2 in the 
                PATH.
  -keeptmp      keep temporary files 
                produced by option -fix.
                default is to clean them up.
                
  -joinfull p   run joinraw and -fix p in 
                one go. required to produce
                mpeg2 video suitable for
                playback.
  -tmpdir d     specify a folder to use for 
                temporary files, and create
                unique filenames within.
  -keepall      keep whole content of input 
                file(s). used only with
                -joinraw.

note:
   - all output files are overwritten 
      without asking back,
     including temporary files. check the 
      simulation output.
   - check free disk space by "sfk space" 
      before processing.
     options -fix or -joinfull will use 
                       double disk space.

general options
   -tofile f     write output to a single 
                 file with name f
   -to outmask   write multiple input files 
                 to output names given by a
                 mask, like -to outdir\
                 $file "sfk help opt" for
                 details.
   -movesrcto x  after processing, move 
                 every video input file to
                 an output folder x. move
                 is done by rename, so x
                 must be on same file
                 system as input. if an
                 output file of same name
                 exists already then add
                 option -force to overwrite.
                 
   -yes          really create or overwrite 
                 output file
   -quiet        do not show progress 
                 indicator
   -quiet=2      or =3 tells even less
   -verbose[=2]  tell more details about 
                 what is done

recommended process for video cutting
   1. download the VLC media player 
   installer,
      run the tool and open an mpeg2 
      .mpg file.
   2. select Playback / Custom bookmarks / 
   manage (CTRL+B).
      for every section to keep, create a 
    bookmark
      at the start and end of that 
    section.
   3. make sure there is an even number 
 of bookmarks.
   4. select Media / Save Playlist (CTRL+Y),
   select file type
      M3U (not m3u8) and save, e.g., to 
      cut01.m3u (if you used the VLC
      installer, it will remember M3U
       as the preferred export type.)
   5. sfk media cut01.m3u -keepbook 
   -tofile out.mpg
      with .mts files and ffmpeg in your 
      path, try instead: sfk media cut01.
      m3u -keepbook -tofile out.mts -fix
      ""
   6. if you process further files in the 
   same VLC session,
      the M3U files may contain references 
      to many files, but only the last
      (newest) entry is used.

see also
   sfk partcopy  - copy a single part of 
                   a file
   sfk space  - tell free disk space 
                   available in current or
                   given directory d

web reference
   http://stahlworks.com/sfk-media

examples sfk media in.mpg -keep 100000-200000 -cut 150000-160000 -tofile out.mpg keep area from offset 100000 to 200000 (with a length of 100000 bytes) except for 10000 bytes inbetween. sfk media in.mpg -keep 120578-301436 518297-783591 -tofile out.mpg keep the two sections and drop the rest. sfk media in.m3u -keepbook -tofile out.mpg keep areas listed in the bookmark M3U file. sfk select mydir .m3u +media -keepbook -to out\$base. mpg execute all .m3u files from mydir, write output files to a folder out, with the same relative name as the input .M3U, but with an .mpg output extension. sfk select n:\dvd1\part1.vob n:\dvd1\ part2.vob +media -joinraw -tofile out.mpg join two .vob files into one out.mpg without any modifications. out.mpg will need post processing before it can be used in a media player. sfk sel -sort d:\ .vob +media -joinfull pal-dvd -tofile out.mpg -tmpdir c:\tmp join all .vob files of a PAL dvd, sorted by name, into one out.mpg and call ffmpeg to fix timestamps. uses a temporary file in c:\tmp. sfk sel -sort d:\ .vob +media -joinfull "-target pal-dvd -map 0:0 -map 0:2" -tofile out.mpg -tmpdir e:\tmp -keeptmp similar to above, but explicitely passing several parameters to ffmpeg, selecting dvd output and to mix channels 0:0 (e.g. video) and 0:2 (e. g. an audio track with alternative language). temporary file is stored on another drive and kept, in case post processing fails and must be done manually.

you are viewing this page in mobile portrait mode with a limited layout. turn your device right, use a desktop browser or buy the sfk e-book for improved reading.

 
sfk is a free open-source tool, running instantly without installation efforts. no DLL's, no registry changes - just get sfk.exe from the zip package and use it (binaries for windows, linux and mac are included).

 

the Endless Image 🍣 Sushi