[Bug 753257] avenc_mjpeg does not play well with appsrc do-timestamp=true
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Fri Oct 23 10:36:29 PDT 2015
https://bugzilla.gnome.org/show_bug.cgi?id=753257
--- Comment #13 from Tim-Philipp Müller <t.i.m at zen.co.uk> ---
The problem here is the transformation of GStreamer timestamps in ffmpeg
timestamps/ticks. The scaling is based on the framerate (or some notional
framerate) in such a way that you're likely get the same result in case your
timestamps are much closer together.
In your example code you basically just push/pull in a tight loop without
sleeping, so the timestamps are only a fraction of a millisecond apart, but
things are set up for 30fps.
This fixes it for me, but it might need other changes, like adjustment of
ticks_per_frame or such, to make sure the bitrate estimation is not affected:
diff --git a/ext/libav/gstavutils.h b/ext/libav/gstavutils.h
index 6d111a2..8485908 100644
--- a/ext/libav/gstavutils.h
+++ b/ext/libav/gstavutils.h
@@ -57,7 +57,7 @@ gst_ffmpeg_time_ff_to_gst (gint64 pts, AVRational base)
if (pts == AV_NOPTS_VALUE){
out = GST_CLOCK_TIME_NONE;
} else {
- AVRational bq = { 1, GST_SECOND };
+ AVRational bq = { 1000, GST_SECOND };
out = av_rescale_q (pts, base, bq);
}
@@ -72,7 +72,7 @@ gst_ffmpeg_time_gst_to_ff (guint64 time, AVRational base)
if (!GST_CLOCK_TIME_IS_VALID (time) || base.num == 0) {
out = AV_NOPTS_VALUE;
} else {
- AVRational bq = { 1, GST_SECOND };
+ AVRational bq = { 1000, GST_SECOND };
out = av_rescale_q (time, bq, base);
}
In your code, you should:
1) set appsrc to is-live=true, because that's more appropriate for your case,
and because without the first buffer will not have a valid timestamp (since
it's produced before the pipeline goes to playing, so no clock yet at that
point.
2) set appsrc to format=time, which is the right thing to do.
3) maybe set framerate=0/1 which means variable framerate (could cause other
issues though, only one way to find out)
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list