Manipulating MPEG-TS timestamps

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Manipulating MPEG-TS timestamps

Charley Robinson
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
$ ffprobe -v -8 -hide_banner -show_entries frame=pkt_pts_time -of csv -i 26.trans.ts | head -1

Any tips or tricks would be most appreciated. Thank you!

gstreamer-devel mailing list
[hidden email]