After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688487 - screen recording not properly ended
screen recording not properly ended
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
3.6.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2012-11-16 19:14 UTC by Matthias Clasen
Modified: 2012-11-19 18:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Log (590.85 KB, application/x-bzip2)
2012-11-18 01:13 UTC, drago01
  Details
test-recoder: Use webm file extension (882 bytes, patch)
2012-11-19 17:56 UTC, drago01
committed Details | Review
shell-recorder-src: Set frame duration (2.22 KB, patch)
2012-11-19 17:56 UTC, drago01
committed Details | Review

Description Matthias Clasen 2012-11-16 19:14:58 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.
Comment 1 drago01 2012-11-17 19:45:26 UTC
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.
Comment 2 Tim-Philipp Müller 2012-11-18 00:53:37 UTC
Could you make a GST_DEBUG=*:6 log of a short recording session and attach it (gzipped if needed)?
Comment 3 drago01 2012-11-18 01:13:27 UTC
Created attachment 229260 [details]
Log

Here is the requested log (without any changes to the current code in master).
Comment 4 Tim-Philipp Müller 2012-11-19 15:33:36 UTC
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 ?
Comment 5 drago01 2012-11-19 16:17:48 UTC
(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
Comment 6 Tim-Philipp Müller 2012-11-19 16:33:38 UTC
> > 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.
Comment 7 drago01 2012-11-19 17:55:34 UTC
(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.
Comment 8 drago01 2012-11-19 17:56:38 UTC
Created attachment 229388 [details] [review]
test-recoder: Use webm file extension

This matches our default pipeline.
Comment 9 drago01 2012-11-19 17:56:49 UTC
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.
Comment 10 Jasper St. Pierre (not reading bugmail) 2012-11-19 18:11:06 UTC
Review of attachment 229388 [details] [review]:

Sure.
Comment 11 Jasper St. Pierre (not reading bugmail) 2012-11-19 18:11:33 UTC
Review of attachment 229389 [details] [review]:

Fine with me.
Comment 12 drago01 2012-11-19 18:16:02 UTC
Attachment 229388 [details] pushed as a0c56c7 - test-recoder: Use webm file extension
Attachment 229389 [details] pushed as e0d127b - shell-recorder-src: Set frame duration