omxh264enc & mp4mux audio not sync when video in 30FPS

Hi there,

I get some issue when mux audio and video into a mp4 file, the audio out of sync when video in 30FPS
the pipeline is kind as following,

appsrc-> omxh264enc -> h264parse ->
mp4mux-> filesink
udpsrc-> rtpmp4gdepay -> aacparse ->

This works fine when “appsrc” get a 60fps video coming, when the it change to 30fps, it is not sync anymore, the only change I did was the frame-rate parameter for the “appsrc”( v_rate ). If I only run video or audio pipeline, there is no problem, I may not take care the timestamp correctly when muxing. Do anyone have ideas on this case, I am struggling this for a while.

so the caps for the “appsrc” is

g_object_set( G_OBJECT( source ),
“is-live”, TRUE,
“format”, 3,
“emit-signals”, TRUE,
“do-timestamp”, TRUE,
“max-bytes”, 0,
“caps”, gst_caps_new_simple( “video/x-raw”,
“format”, G_TYPE_STRING, “I420”,
“width”, G_TYPE_INT, v_width,
“height”, G_TYPE_INT, v_height,
“framerate”, GST_TYPE_FRACTION, (int)v_rate*1000, 1000,
NULL ),
NULL );

so the caps for the “udpsrc” is

g_object_set( G_OBJECT( gstptr->audio_src ),
“address”, “127.0.0.1”,
“do-timestamp”, TRUE,
“port”, 5006,
“caps”, gst_caps_new_simple( “application/x-rtp”,
“media”, G_TYPE_STRING, “audio”,
“clock-rate”, G_TYPE_INT, 48000,
“encoding-name”, G_TYPE_STRING, “MPEG4-GENERIC”,
“encoding-params”, G_TYPE_STRING, “2”,
“streamtype”, G_TYPE_STRING, “5”,
“profile-level-id”, G_TYPE_STRING, “2”,
“mode”, G_TYPE_STRING, “AAC-hbr”,
“config”, G_TYPE_STRING, “1190”,
“sizelength”, G_TYPE_STRING, “13”,
“indexlength”, G_TYPE_STRING, “3”,
“indexdeltalength”, G_TYPE_STRING, “3”,
“constantDuration”, G_TYPE_STRING, “1024”,
“payload”, G_TYPE_INT, 96,
NULL ),
NULL );

Hi usaarizona,
Have you checked if the timestamp is in 30fps in appsrc?

Please also check if removing the following caps of appsrc helps
“is-live”, TRUE,

Must be wrong timestamps because there is a working case:
https://devtalk.nvidia.com/default/topic/988771/jetson-tx1/tsdemux-failure-with-audio-and-video-/post/5062261/#5062261