Manipulating MPEG-TS timestamps

Charley Robinson charley.p.robinson at gmail.com
Thu Sep 5 15:28:09 UTC 2019


Hi all-
I'm wondering if anyone can give me pointers about how to go about
manipulating the output PTS values in mpeg transport streams produced by
the mpegtsmux element? I've got a source container with PTS values starting
at nonzero values (think HLS segments), and I'd like to rescale and
transcode the container, while preserving the timestamps of the source in
the destination.

As a strawman example:

gst-launch-1.0 -q filesrc location=./15.src.ts \
! tsdemux ! h264parse ! avdec_h264 \
! videorate ! videoscale ! videoflip method=clockwise \
! video/x-raw,width=720,height=1280,framerate=30/1 \
! x264enc ! mpegtsmux ! \
queue ! filesink location=./15.trans.ts sync=false

When inspecting the source and dest files, we can see the PTS values reset
to zero (or kinda zero - I'm not sure why it likes to start at 3.6 seconds,
but you get the idea):

$ ffprobe -v -8 -hide_banner -show_entries frame=pkt_pts_time -of csv -i
26.src.ts | head -1
frame,3753.511222
$ ffprobe -v -8 -hide_banner -show_entries frame=pkt_pts_time -of csv -i
26.trans.ts | head -1
frame,3600.000000

Any tips or tricks would be most appreciated. Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20190905/3b7e7447/attachment.html>


More information about the gstreamer-devel mailing list