ffmpeg makes this very easy indeed - and its a program already installed on your system, hopefully.
the command needed looks like this
-ss
option for start position in the track - either hh:mm:ss or just seconds
-t
the duration time to cut until, also hh:mm:ss or just seconds
-i
the input file
-acodec or -c:a
sets the audio codec to use - and "copy" keeps the original codec and quality
-aq or -q:a
will set the audio quality (VBR or variable bitrate), e.g. -aq 200
-ab or -b:a
will set audio bitrate, e.g. -ab 192k
(I tried the option -to which sets the cut-up-to point, and is found in ffmpeg man page, but it doesn't work at all)
It would follow that video files can be cut as well, but with compressed video files the results might not be perfect, as with h264 mp4 if you make cuts on frames that are not "key frames" you will very likely end up with smearing of video data (blocky picture at the cut point). So Avidemux would be a safer option with cutting compressed video, but with raw AVI you could try ffmpeg.
This is how i cut up an audio track...
1. open track in audacity
2. select the part of the track to cut
3. set the selection measure at bottom to "Length" and units of seconds
4. copy and insert the start/duration on the ffmpeg line, e.g.
I'm using ranger as well, so I have a mapped key with the ffmpeg line, like this
I noticed a glitch, however, which I couldn't sort out. For three out of 20 cuts I made, the file produced was only 1K in size -and I checked and rechecked the values on the ffmpeg line. Hmm.. so for those few what I did was export the selection straight from Audacity - change output format to "(external program)" and in Options under that, select ffmpeg.
It works just as well, although it seems to take a little longer to process (because a file opened in audacity is first conveeted to raw data so that edits and effects can be made - which means exporting a chunk of a track will require that audacity re-encode it to a lossy format, hence the little extra time it takes compared to cutting a lossy format file with ffmpeg).
ffmpeg results! Most of the cut tracks have up to 10 or 15 sec of the previous track ending on the front of them, sometimes the start of the next track at the end... even when I was precise with the values taken from audacity, so what's going on there???
--> because of that, I found it easier to export the selection from audacity as ogg file, q 8.
I have some useful video conversion commands on this page transcoding-mts
flac to ogg
this searches to the lowest levels of directories first, built on the basic form of
the problem with the recursive command above is that it's not very tidy, results-wise, as find just puts ".ogg" onto the end of the full file name with extension, so song.flac > song.flac.ogg
a script makes the results tidier, without the need to search/replace "flac.ogg" everywhere
This searches in the current directory. To make it recursive you can try double globbing:
there is also oggenc
also dir2ogg
flac to mp3
or in a script,
Tip: add the option -size to hit files of certain size and above, e.g.