GNOME Bugzilla – Bug 688487
screen recording not properly ended
Last modified: 2012-11-19 18:16:10 UTC
The webm recordings that I produce with the shell screen recorder all claim to be 2 seconds long: $ gst-discoverer-1.0 Videos/hi-there.webm Analyzing file:///home/mclasen/Videos/hi-there.webm Done discovering file:///home/mclasen/Videos/hi-there.webm Topology: container: WebM video: VP8 Properties: Duration: 0:00:02.847000000 Seekable: yes Tags: video codec: VP8 video container format: Matroska In reality, this recording is 13 seconds long, and totem does play all 13 seconds, despite showing the wrong duration. pitivi, on the other hand, can't really make use of these clips. Bastien says this is probably because the recording is not properly ended, and the header is not updated. Transcoding the file from webm to webm with transmageddon seems to fix things up. But we should really not produce broken webm files in the first place.
After playing with it for a whole day I can't find anything wrong with what the shell does ... even sending an eos event to every single element in the source before setting the pipeline's state to NULL does not work. So unless I missed something obvious or the docs are missing something not mentioned anywhere this looks like a gstreamer bug to me.
Could you make a GST_DEBUG=*:6 log of a short recording session and attach it (gzipped if needed)?
Created attachment 229260 [details] Log Here is the requested log (without any changes to the current code in master).
Do you have a gst-launch-1.0 command line that reproduces the problem by any chance? (It works fine for me with v4l2src ! vp8enc ! webmux ! fdsink, fwiw). Can you reproduce the problem with a different source, such as v4l2src or videotestsrc ?
(In reply to comment #4) > Do you have a gst-launch-1.0 command line that reproduces the problem by any > chance? (It works fine for me with v4l2src ! vp8enc ! webmux ! fdsink, fwiw). No. > Can you reproduce the problem with a different source, such as v4l2src or > videotestsrc ? No ... when I do: diff --git a/src/shell-recorder.c b/src/shell-recorder.c index 0f6a6fb..d5f330a 100644 --- a/src/shell-recorder.c +++ b/src/shell-recorder.c @@ -1098,7 +1098,8 @@ recorder_pipeline_add_source (RecorderPipeline *pipeline) goto out; } - pipeline->src = gst_element_factory_make ("shellrecordersrc", NULL); + pipeline->src = gst_element_factory_make ("videotestsrc", NULL); + gst_base_src_set_live (pipeline->src); if (pipeline->src == NULL) { g_warning ("Can't create recorder source element"); @@ -1525,10 +1526,10 @@ recorder_open_pipeline (ShellRecorder *recorder) bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline->pipeline)); gst_bus_add_watch (bus, recorder_pipeline_bus_watch, pipeline); gst_object_unref (bus); - +/* g_signal_connect (pipeline->src, "notify::memory-used", G_CALLBACK (recorder_pipeline_on_memory_used_changed), pipeline); - +*/ recorder->current_pipeline = pipeline; recorder->pipelines = g_slist_prepend (recorder->pipelines, pipeline); @@ -1549,7 +1550,8 @@ recorder_close_pipeline (ShellRecorder *recorder) * is written. The bus watch for the pipeline will get it and do * final cleanup */ - shell_recorder_src_close (SHELL_RECORDER_SRC (recorder->current_pipeline->src)); + /*shell_recorder_src_close (SHELL_RECORDER_SRC (recorder->current_pipeline->src)); */ + gst_element_send_event (recorder->current_pipeline->src, gst_event_new_eos()); recorder->current_pipeline = NULL; } i.e use a live videotestsrc instead of shellrecordersrc the video created by test-recorder has the correct length (4 seconds). So something must be wrong with the shellrecordersrc. I have no idea what though ... it returns GST_FLOW_EOS from its create() implementation which should be enough according to the docs. Here is a test case that you can try to reproduce with without having to compile the shell: http://94.247.144.115/test-recorder.tar.bz2 Just compile with: gcc `pkg-config --cflags gstreamer-base-1.0 clutter-1.0 cogl-1.0 gtk+-3.0` *.c `pkg-config --libs gstreamer-base-1.0 clutter-1.0 cogl-1.0 gtk+-3.0` -o test-recorder test-recorder should record a 4 seconds long video and put it into ~/Videos/test-recorder.webm
> > Can you reproduce the problem with a different source, such as v4l2src or > > videotestsrc ? > > No ... (snip) Ok, that's an interesting observation then. Check if your source operates in GST_FORMAT_TIME format, and make sure you put timestamps on the buffers you produce, or tell the source to timestamp buffers according to the system clock if it's live. > Here is a test case that you can try to reproduce with without having to > compile the shell: > > http://94.247.144.115/test-recorder.tar.bz2 Awesome! I will give this a shot later.
(In reply to comment #6) > > > Can you reproduce the problem with a different source, such as v4l2src or > > > videotestsrc ? > > > > No ... (snip) > > Ok, that's an interesting observation then. Check if your source operates in > GST_FORMAT_TIME format, and make sure you put timestamps on the buffers you > produce, or tell the source to timestamp buffers according to the system clock > if it's live. Thanks that was the pointer in the correct direction ... we where setting a timestamp but no duration which made gstreamer unhappy. Setting the duration correctly makes it work.
Created attachment 229388 [details] [review] test-recoder: Use webm file extension This matches our default pipeline.
Created attachment 229389 [details] [review] shell-recorder-src: Set frame duration We where not setting a duration for the frames, which caused the resulting videos to have a broken header. Fix that by making the source a live source and setting the correct frame duration.
Review of attachment 229388 [details] [review]: Sure.
Review of attachment 229389 [details] [review]: Fine with me.
Attachment 229388 [details] pushed as a0c56c7 - test-recoder: Use webm file extension Attachment 229389 [details] pushed as e0d127b - shell-recorder-src: Set frame duration