How get file size using gstreamer queries elements

trinitonadam trinitonadam at
Wed Jul 10 08:25:16 PDT 2013

I use gst_element_query_position to get size of encoded file in bytes:

			gin64 val;

			if (gst_element_query_position (pipeline, GST_FORMAT_BYTES, &val)) {

				gchar *file_size = g_format_size_full (val, G_FORMAT_SIZE_LONG_FORMAT);
				gtk_label_set_text (GTK_LABEL (file_size_label), file_size);
				g_free (file_size);

when convert 10 secs stream in lossless format (FLAC) output is precise:

			685.8 kB (685,799 bytes)


when convert 10 secs stream in lossy format (OGG) output is wrong:

			10.1 GB (10,418,503,401 bytes)


Any help to solve this is welcome.

View this message in context:
Sent from the GStreamer-devel mailing list archive at

More information about the gstreamer-devel mailing list