diff --git a/example/convts.sh b/example/convts.sh index ca86cce..7623ed2 100644 --- a/example/convts.sh +++ b/example/convts.sh @@ -1,2 +1,4 @@ -avconv -i tiny2.mov -acodec aac -vcodec h264 -strict experimental tiny2.ts +./avconv -loglevel debug -y -i /tmp/tiny2.mov \ + -bsf h264_mp4toannexb -acodec copy -vcodec copy -strict experimental /tmp/out.ts 2>&1 + diff --git a/reader.go b/reader.go index 6054f8a..347481e 100644 --- a/reader.go +++ b/reader.go @@ -68,6 +68,7 @@ func ReadTSHeader(r io.Reader) (self TSHeader, err error) { {13, "pid"}, {2, "scrambling_control"}, {1, "adaptation_field_flag"}, + {1, "payload_flag"}, {4, "continuity_counter"}, }, Val: flags, @@ -76,6 +77,7 @@ func ReadTSHeader(r io.Reader) (self TSHeader, err error) { } if flags & 0x400000 != 0 { + // When set to '1' it indicates that this TS packet contains the first PES packet. self.PayloadUnitStart = true } @@ -516,8 +518,8 @@ func ReadPESHeader(r io.Reader) (res *PESHeader, err error) { self.PTS = PESUIntToTs(v) if debug { - fmt.Printf("pes: pts %x(%x)=>%x %f\n", - v, (v>>1)&0xef, self.PTS, float64(self.PTS)/90000) + fmt.Printf("pes: pts %x=>%x %f\n", + v, self.PTS, float64(self.PTS)/90000) } }