Page 1 of 1

Extract a chunk from TS file ?

Posted: 10 Sep 2016 14:24
by rmvb
Hi
I recorded from my set top box freebox a file which appears to be a TS file. The recording is far too long and I'd like to cut out the end.
I found I can add :stop-time=3755 in the advanced options of the Open/Convert dialog. The original file works as is, so I'd rather not convert it to another format/container so I created a profile base on settings I found in a TS preset one and checked both keep video and audio, but this ends in 0 byte file. When I choose "Record raw stream" from the dialog I get "Unsupported operation" (VLC2.1.6 Ubuntu 14.04.5 amd64)
I have no debian-multimedia repo in my system.

Please what do I wrong ?

Thank you for advises

Re: Extract a chunk from TS file ?

Posted: 11 Sep 2016 14:29
by kmf31
multicat works perfectly to cut "chunks from a TS file":

http://www.videolan.org/projects/multicat.html

and it also belongs to the videolan project.

It compiles very easily and well from the sources (nearly no other lib necessary).

After compilation/installation:
1) create a kind of index using the command "ingests -p <PCR PID> $FILE"
which comes with the package and where PCR PID is the video PID of your file (to find this run your file in vlc and look in "codecs" etc.).

2) multicat -f -k $T1 -d $T2 -a $FILE $OUTFILE
where $T1=start-time in seconds multiplied with 27000000 and
$T2=length in seconds multiplied with 27000000

(you can write a script to do the multiplication and have more "confort" in calling multicat etc.). More details in README file and man-page of this package.

This works much better/faster than TS-cutting with vlc and it is much more reliable for the precise end-time. It also perfectly conserves the TS-structure (including all audio and subtitle tracks etc.).

Re: Extract a chunk from TS file ?

Posted: 11 Sep 2016 22:20
by rmvb
Thank you very much man, even v2.0.3 from ubuntu14.04 repos did the job. No need to compile :)

Newbies like me, be aware that man multicat is much smaller than multicat -h
Before I discovered this I ran the kfm31 command without -f & -k (fortunately the chunk I needed started at 00:00:00 which
is the default when -k is omitted).

Something else : when reading the input file from the same usb(3) stick to which I wrote the output I got
"warning: too much lateness, resetting clocks" several times. I Ctrl^C'ed then restarted giving my SSD as target drive : no more error

Great VLC team :))

Re: Extract a chunk from TS file ?

Posted: 18 Sep 2016 13:13
by InTheWings
That's ts. Non precise cuts can just be done with truncate.