[Libav-user] How do I change the .TS files "Timestamps and Continuity Counters"?

Wagner Patriota wagner.patriota at gmail.com
Fri May 18 23:33:25 CEST 2012


I am working in a implementation of HLS protocol.
http://tools.ietf.org/html/draft-pantos-http-live-streaming-08

I see all my .TS files have the "audio timestamp" equal to 126000.

According to the HLS specification, section 4 Media segments, it says:

A media segment MUST be the continuation of the encoded media at the
end of the segment with the previous sequence number, where values in
a continuous series, such as *timestamps* and *Continuity Counters*,
continue uninterrupted - unless the media segment was the first ever
to appear in the Playlist file or has an EXT-X-DISCONTINUITY tag
applied to it.


And then I see my videos are getting out of sync because of it. *How do I
change the .TS files "timestamps and Continuity Counters"?*
*
*
Thank you...



*[ DEEP DETAILS: ]*
I am transmuxing the HLS files one by one, so I would like to have a
parameter [that I think it doesn't exist here]

MPEGTS muxer AVOptions:
-mpegts_transport_stream_id <int>   E.... Set transport_stream_id field.
-mpegts_original_network_id <int>   E.... Set original_network_id field.
-mpegts_service_id <int>   E.... Set service_id field.
-mpegts_pmt_start_pid <int>   E.... Set the first pid of the PMT.
-mpegts_start_pid  <int>   E.... Set the first pid.
-mpegts_m2ts_mode  <int>   E.... Enable m2ts mode.
-muxrate           <int>   E....
-pes_payload_size  <int>   E.... Minimum PES packet payload in bytes
-resend_headers    <int>   E.... Reemit PAT/PMT before writing the next
packet

SO, with this "parameter" I would have a chance to change this data...
however, I tried to figure out in the mpegtsenc.c WHERE is this "timestamp"
or continuity counter...

I thought it would be somthing around here:

typedef struct MpegTSWriteStream {
    struct MpegTSService *service;
    int pid; /* stream associated pid */
*    int cc;*
    int payload_size;
*    int first_pts_check; ///< first pts check needed*
    int prev_payload_key;
    int64_t payload_pts;
    int64_t payload_dts;
    int payload_flags;
    uint8_t *payload;
    ADTSContext *adts;
} MpegTSWriteStream;


BUT I think I misinterpreted it... because in the mpegts_write_header(), we
have:
    ts->pat.pid = PAT_PID;
    ts->pat.cc = 15; // Initialize at 15 so that it wraps and be equal to 0
for the first packet we write

as fixed values.... so I don't understand HOW THE mpegtsenc MUXER GOT
126000 as the timestamp... where is this value in mpegtsenc.c so I could
tune it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120518/cc8e4e30/attachment.html>


More information about the Libav-user mailing list