Log in

View Full Version : Cutt h.264 AVC?


Lulle
23rd October 2007, 20:25
Hi!
Doe's someone have a good tool to cutt h.264 AVC .ts files?

I have tryde h264ts_cutter_v106 .. But it crashes for me.

So now I search for an other tool.

Has123
23rd October 2007, 21:13
I use TSRemux and it works flawlessly. You have to input the start and the end timing though.

Lulle
24th October 2007, 11:48
Dosent work with my .ts stream.

The file gets like 3mb and it's no sound or video in it.

Schmendrick
24th October 2007, 12:04
You should use TS Packet Editor ( http://www.techpowerup.com/downloads/435/TS_Packet_Editor_0.301.html ) to analyze your TS files. If you load a ts-file and then push on "Scan" then you get a report if the programme finds continuity errors in the ts-file. It might be likely that your ts-files have continuity errors, which means that parts of required content is missing and that might be why the other cutter programmes are unable to process them.

Lulle
24th October 2007, 12:48
You should use TS Packet Editor ( http://www.techpowerup.com/downloads/435/TS_Packet_Editor_0.301.html ) to analyze your TS files. If you load a ts-file and then push on "Scan" then you get a report if the programme finds continuity errors in the ts-file. It might be likely that your ts-files have continuity errors, which means that parts of required content is missing and that might be why the other cutter programmes are unable to process them.

here is my logg:
Attempting To Open File...
Attempting To Open Video, this may take a while...
Configuring Video Window
Displaying Video
Video Resolution: 1280 x 720 @ 50 fps
File size: 3191314476
Auto Finding PIDs

Scanning File...

PID List:
Found PID: 0000: PAT Ver: 7 TS ID: 0x0028
Found PID: 0104: Program : 1064
Found PID: 1104: MPEG1 Audio (ISO/IEC 11172-3 Audio)
Found PID: 1004: H.264/AVC Video (as defined in ITU-T Rec. H.264 | ISO/IEC 14496-10 Video)

Continuity Errors: 0, Transport Error Indicator Errors: 0

Scan Complete.
Time Taken: 670,39 secs

Lulle
24th October 2007, 13:41
It's nothing wrong @ my .ts file.

Does someone have an other .ts cutting tool?

Schmendrick
24th October 2007, 17:38
Hi Lulle,

if you are able to understand german on:
http://www.alice-dsl.net/schmendrick/
you can find some information to use a Hex-Editor
to "manually" cut a ts-file.
The essential method is to search for an I-Frame-Flag
byte sequence, which is in Hex-values: "00 00 00 01 65" where "65" might be "25" or "45" as well depending from your source. AVC/H.264-frames usually consist out of six frame slices which all have this header byte flage sequence. Ahead of the first of these six I-frame-flags you will other flagging byte sequences like "00 00 00 01 68" as the „H264 Picture Parameter Set“, "00 00 00 01 67" as the „H264 Sequenz Parameter Set“ and „00 00 00 01 09“ as the „H264 Access unit delimiter“. Ahead of this you will find „00 00 01 E0“ as the
programme elementary video flag which is followed besides other parameters by the PTS (presentation time stamp).
Aout 12 bytes ahead the byte "47" should be present which is the transportstream startcode. This byte is followed by two byte "WX YZ" where if W=4 then this signals a startindicator of a sequence of transport packets. "XYZ" then is the 12-bit value of the PID of the corresponding content of the transport stream packet.

If you cut just ahead of this "47" value then a click starting with this will have a valid I-frame at the beginning.

Like in MPEG2-clips where a video also always has to start with an I-frame also an AVC/H.264-video-clip can end not only after an I-Frame but also after a P-frame, but not after a B-frame. The flag code for a P-frame slice is "00 00 00 01 61" and for a B-frame slice it is "00 00 00 01 01".

The cut at the end has to be set accordingly just before the following transport stream start code ("47") of a following frame slice.

As audio streams do not have start frames the only thing you will have to worry about is the fact that there usually is a delay in a transport stream between the video and the audio track. If you can use xport then xport already corrects this delay. Otherwise as most of the time the audio track lags up to 3 seconds behind the video track you first have only to worry about to cut the video track as close as possible to where you want to cut it (remember you have to use an I-frame) and then cut the end deliberately about the time delay too late in order to be sure the include the required part of the audio track or you choose to loose the delay part of the audio track at the end of the cut clip when viewing it with an appropriate player like PowerDVD7Ultra.

I know this a tedious method but it works.

Schmendrick

Has123
27th October 2007, 20:36
I tried the new version of h264tscutter http://www.h264tscutter.de/bin/h264ts_cutter_v107.zip and it worked without problems.