Video and audio are out of sync when using nvh264dec
Ubuntu 18.04, GStreamer 1.18.4
I have a problematic source: https://drive.google.com/file/d/1I7G8qHhsedeW9-_hjiqoP4Lh643g_cEP/view
When I work with it I get a lot of warnings:
mpegtspacketizer mpegtspacketizer.c:2365:mpegts_packetizer_pts_to_ts: Not enough information to calculate proper timestamp
mpegtspacketizer mpegtspacketizer.c:2363:mpegts_packetizer_pts_to_ts: No groups, can't calculate timestamp
tsdemux tsdemux.c:2295:check_pending_buffers: THIS SHOULD NOT HAPPEN !
basetsmux gstbasetsmux.c:1611:gst_base_ts_mux_clip:<mux:sink_1> ignoring DTS going backward
But when I use avdec_h264 with nvh264enc everything is fine:
gst-launch-1.0 --gst-debug=3 \
filesrc location="source01.ts" ! queue ! tsdemux name=demux \
demux. ! queue max-size-time=0 ! h264parse ! avdec_h264 ! queue ! videoconvert ! nvh264enc bitrate=4196 ! queue ! h264parse ! queue ! mux. \
demux. ! queue max-size-time=0 ! aacparse ! avdec_aac_latm ! queue ! audioconvert ! faac bitrate=196608 ! queue ! aacparse ! queue ! mux. \
mpegtsmux name=mux ! hlssink playlist-length=10 playlist-location="playlist.m3u8" location="fragment%06d.ts"
If I try to use nvh264dec and nvh264enc, then video and audio are out of sync:
gst-launch-1.0 --gst-debug=3 \
filesrc location="source01.ts" ! queue ! tsdemux name=demux \
demux. ! queue max-size-time=0 ! h264parse ! nvh264dec ! queue ! videoconvert ! nvh264enc bitrate=4196 ! queue ! h264parse ! queue ! mux. \
demux. ! queue max-size-time=0 ! aacparse ! avdec_aac_latm ! queue ! audioconvert ! faac bitrate=196608 ! queue ! aacparse ! queue ! mux. \
mpegtsmux name=mux ! hlssink playlist-length=10 playlist-location="playlist.m3u8" location="fragment%06d.ts"
When I try to play the result with nvh264dec in ffplay, warnings are displayed:
DTS 324214713 < 324228227 out of order
Is it possible to make nvh264dec to handle the source correctly in the way as avdec_h264 does?