Due to an influx of spam, we have had to impose restrictions on new accounts. Please see this wiki page for instructions on how to get full permissions. Sorry for the inconvenience.
Admin message
The migration is almost done, at least the rest should happen in the background. There are still a few technical difference between the old cluster and the new ones, and they are summarized in this issue. Please pay attention to the TL:DR at the end of the comment.
Created attachment 278728
It is an example of how to use GstImageSequenceSrc
Hello guys. I've written an element in gst-plugins-bad which I called as GstImageSequenceSrc. It works very similar to GstMultiFileSrc, but there are some differences.
Differences with GstMultiFileSrc.
Handles a list of filenames instead of a printf pattern as GstMultiFileSrc does.
Having a list of filenames is useful because you can set the filenames you want,
in the order you want. For example, you can add more filenames or sort the list.
There are two ways to create this list:
a) Setting a location propertie. This value could look like:
1) "/some/folder/with/images/ or ."
2) "/a/path/img.jpg,/other/path/img2.jpg" or "img1.png,img2.png"
3) "/a/path/.JPEG" or ".png"
b) Setting the filename-list (GList) directly.
Why not supporting it ? Isn't it trivial in this case ?
@@ +136,3 @@+ } else { + src->index = 0; + GST_WARNING_OBJECT (src, "No FPS set, can not seek");
I'm thinking you are not checking the right thing in is_seekable()
@@ +170,3 @@+ g_param_spec_boolean ("loop", "Loop", + "Whether to repeat from the beginning when all files have been read.", + FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Have you tested that seeking work when this is enabled ?
Pointer is kind of the worst, and is not binding friendly (will leak in python). You might need to dig around to make sure life-time works, but it's probably a boxed.
@@ +181,3 @@+ "index is incremented by one for each buffer read.", + 0, INT_MAX, DEFAULT_INDEX, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Is this needed ?
@@ +188,3 @@+ "is reached, the index will be set to the value start-index.", + 0, INT_MAX, DEFAULT_START, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
It's not clear what is this used for, looks like copy pasted from multifilesrc, but documentation does not match.
@@ +193,3 @@+ "Stop value of index. The special value -1 means no stop.", + -1, INT_MAX, DEFAULT_STOP, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Please, as some care to avoid division by zero. Also, use the gst_util_uint64_scale utility to avoid overflow.
@@ +436,3 @@+ /* FIXME: This is hacky */ + if (!mime) + mime = "image/jpeg";
Please fix. This imply that props are set in specific order or something, we don't want this. Make sure that you compute stuff on state transition instead.
reverse: I've implement it but I am not sure how to test it (it is not in the
patch)
For testing reverse playback (and seeking in reverse), you can use the playback test in gst-plugins-base (gst-plugins-base/tests/examples/playback/playback-test). To run a custom pipeline:
I should be able to give this a second pass soon, unless someone is faster ;-P. A small note, when you update a patch, please mark the old one as obsolete, helps keeping the attachment clean.
Ok guys... I am keep this element simple and ready to merge. This element is using a location pattern as multifilesrc does and a location which is a playlist file.
Nicolas Dufresne @ndufresne reviewed patch 282033:
Please use git format-patch. I'll stop there, maybe I'm confused. So what do you want to propose, a playlist base image sequence or a mix of playlist/pattern element ?
::: gst/sequences/gstimagesequence.c @@ +39,3 @@+ GST_VERSION_MINOR, + imagesequencesrc, + "Reads/Writes buffers from sequentially named image files",
From playlist ?
::: gst/sequences/gstimagesequencesrc.c @@ +20,3 @@+ * SECTION:element-gstimagesequencesrc + * + * Reads buffers from sequentially named files.
There was a problem with seeking that happened with non-PNG format. I've fixed it and I've tested it with some seeking scenarios in gst-validate and it works correctly and for different formats (PNG/JPEG/TIFF, I didn't tested more). Please review it. Now I think this is really ready to merge.
Hi Fabian,
In which branch of yours on github can I find your correct/official/final work? I'm confused because I can't find this particular patch in any of them. There's a bunch of branches and I don't know which one is the correct one, please delete the irrelevant ones so I have one branch in pitivi and one branch in gst to test.
Thank you Fabian,
I would still recommend deleting the other branches from the github repo if you're not using them anymore, for clarity... anyway, I found two bugs (I'm guessing those are issues in your Pitivi branch rather than the gst plugins bad code):
It should be noted for whoever is reading this that I did not review the code at all, just checking if the thing actually works as advertised. I'm happy to report that besides the little bugs above, it does work. Congratulations! :)
Hmm, I tested the "sequences" branch for both your gst plugins bad repo and your pitivi repo (I supposed I needed to be using the same branch names in both), instead of "imagesequences" or whatever the proper branch is supposed to be for your pitivi repo. This is exactly why I ask to remove obsolete branches.
You still have 7 branches sitting around in https://github.com/cfoch/pitivi-cfoch/branches, 4 of which are related to image sequences — I want only one sequences branch to test to avoid confusion, unless you have really clear names and good reasons to have more than one.
Nicolas Dufresne @ndufresne commented on patch 282033:
Please mask older version as obsolete. Also, reply to reviews stating if you are fixing it somehow, or explaing why it's write. Just dropping a new patch does not help the reviewer.
Yeah, marking older patch versions as "obsolete" in bugzilla is important.
For example, it wasn't entirely clear to me just now if attachment #282033 is obsoleted by attachment #283434, and if attachment #283434 is obsoleted by the current state of your git branch. Keep that crystal-clear at all times please.
Nicolas Dufresne @ndufresne reviewed patch 283434:
Please address this first row of comment. In general I think this element is trying to do too much. I would suggest to pick one useful way, e.g. playlist, and stick with that. Drop stuff (which seems broken anyway) like start-index/stop-index, seeking can handle that anyway.
::: gst/sequences/gstimagesequencesrc.c @@ +21,3 @@+ * + * Reads buffers from a location. The location is or a printf pattern + * or a playlist of files. Check below to see examples.
You state 3 ways of using the element, but only document the playlist.
@@ +27,3 @@+ + * Plays a sequence of all images which matches the given printf location pattern at 24 fps. + * GstImageSequenceSrc has internally an index value which goes form src->start_index to src->stop_index.
This drop-in information lacks context. In what is it related to the following example ?
Would be nice to elaborate more on the playlist format. Can we add mixed type, can metadata be added multiple time ? Can we mix image type, e.g. png/jpeg ?
@@ +152,3 @@+ g_param_spec_string ("location", "File Location", + "Pattern to create file names of input files. File names are created " + "by calling sprintf() with the pattern and the current index.",
There is no mention that this location can be a playlist.
Please address this first row of comment. In general I think this element is
trying to do too much. I would suggest to pick one useful way, e.g. playlist,
and stick with that. Drop stuff (which seems broken anyway) like
start-index/stop-index, seeking can handle that anyway.
Reads buffers from a location. The location is or a printf pattern
or a playlist of files. Check below to see examples.
You state 3 ways of using the element, but only document the playlist.
@@ +27,3 @@
+
Plays a sequence of all images which matches the given printf location
pattern at 24 fps.
GstImageSequenceSrc has internally an index value which goes form
src->start_index to src->stop_index.
This drop-in information lacks context. In what is it related to the following
example ?
@@ +39,3 @@
image,location=/path/to/b.png
image,location=/path/to/c.png
]|
Would be nice to elaborate more on the playlist format. Can we add mixed type,
can metadata be added multiple time ? Can we mix image type, e.g. png/jpeg ?
GST_DEBUG_OBJECT (src, "Set (stop-index) property to (%d)",
src->stop_index);
Did you forget to set the stop index ?
@@ +243,3 @@
gst_imagesequencesrc_parse_location (src);
gst_imagesequencesrc_set_start_index (src);
gst_imagesequencesrc_set_stop_index (src);
So going to pause will likely reset what have been set through properties. I
can't find code that would handle that.
(In reply to comment 16)
Review of attachment 283434 [details]:
Please address this first row of comment. In general I think this element is
trying to do too much. I would suggest to pick one useful way, e.g. playlist,
and stick with that. Drop stuff (which seems broken anyway) like
start-index/stop-index, seeking can handle that anyway.
Reads buffers from a location. The location is or a printf pattern
or a playlist of files. Check below to see examples.
You state 3 ways of using the element, but only document the playlist.
@@ +27,3 @@
+
Plays a sequence of all images which matches the given printf location
pattern at 24 fps.
GstImageSequenceSrc has internally an index value which goes form
src->start_index to src->stop_index.
This drop-in information lacks context. In what is it related to the following
example ?
@@ +39,3 @@
image,location=/path/to/b.png
image,location=/path/to/c.png
]|
Would be nice to elaborate more on the playlist format. Can we add mixed type,
can metadata be added multiple time ? Can we mix image type, e.g. png/jpeg ?
GST_DEBUG_OBJECT (src, "Set (stop-index) property to (%d)",
src->stop_index);
Did you forget to set the stop index ?
@@ +243,3 @@
gst_imagesequencesrc_parse_location (src);
gst_imagesequencesrc_set_start_index (src);
gst_imagesequencesrc_set_stop_index (src);
So going to pause will likely reset what have been set through properties. I
can't find code that would handle that.
Thanks, stormer.
I am going to remove the printf pattern location. By removing it, it means forget about stop-index and start-index: it does not make sense to have a start-index and a stop-index property for a list of files (the start is 0 and the stop is the len - 1, actually I've realized stop is not necessary).
"""
Would be nice to elaborate more on the playlist format. Can we add mixed type,
can metadata be added multiple time ? Can we mix image type, e.g. png/jpeg ?
"""
2. Yes! I want to do that. But after the patch with the changes described in 1.
Hello. I am removing the printf location and, as consecuence, removing the start/stop index, because it doesn't make sense to have them if we don't handle the location pattern. I am "Fixing" some details about documentation. So... finally the element handles image sequences (same mimetype format) using a playlist only.
Patch 286661, "Imagesequencesrc: removed printf location pattern. removed stop/start index. it handles the playlist only.": gstimagesequencesrc_simple.patch
Nicolas Dufresne @ndufresne reviewed patch 286661:
Here's few more comments. The most important part, move blocking IOs on the playlist to the streaming thread, make sure it can be canelled when doing to READY state (just in case something wrong happens). ->create() is run from the streaming thread, negotiation() also.
Moving to -good, I think this should just be added to the multifile plugin.
I think I started a branch for integration a while back as well (but that shouldn't stop anyone from merging it or working on it), but I'd like to have a final look at the API (properties) before it gets merged.
@@ +40,3 @@+ imagesequencesrc, + "Reads/Writes buffers from a playlist of image file or from a location (printf) pattern.", + plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN)
What about using a more "standard" playlist format? m3u or PLS for example? You could have the framerate as metadata in there, and optionally also allow durations
Shouldn't the index become whatever index would be at the seek position? Also here you don't prevent seeks with negative rates, do you actually handle them?
@@ +165,3 @@+ "Set a list of filenames directly instead of a location pattern." + "If you *get* the current list, you will obtain a copy of it.", + G_TYPE_PTR_ARRAY, G_PARAM_READWRITE));
A GPtrArray for properties is not such a good idea. This should be a GValueArray for introspection purposes
@@ +169,3 @@+ gst_param_spec_fraction ("framerate", "Framerate", + "Set the framerate to internal caps.", + 1, 1, G_MAXINT, 1, -1, -1,
Why negative? Should probably be 0/1 (or 1/G_MAXINT) to G_MAXINT/1 with 1/1 being the default
Why do we need this? What if you want to have a mixed playlist with JPG, PNG, etc? I think it's ok to always return ANY here and just configure the correct caps on the srcpad for each buffer. Always returning the current caps is strictly speaking not correct
You probably want at least to check if playing with a printf style URI works, with a playlist works... and for each also check the timestamps of all the buffers and check if they actually arrived. Bonus points for seeking tests too :)
There's G_TYPE_STRV for string array properties for what it's worth.
I would prefer to see support for any kind of playlist file removed from this plugin, especially anything containing caps. If we really must support reading filenames from a file, then it should just be filenames newline-separated IMHO, and no further structure than that. We can typefind files to figure out the caps (if needed). If they can't be figured out from the header, this element is not for such files ;)
The purpose of GstImageSequenceSrc is to give the developer an easier way to handle sequences of images. Currently Gstreamer have an element called multifilesrc which is useful to stream image of sequences, but since it is more generic. GstImageSequenceSrc pretends to focus on images. Problems ~~~~~~~~ * Gstreamer's multifilesrc can stream image of sequences, but it is limited to file names following the printf format: "%04d". * It is not possible to tell Gstreamer´s multifilesrc, the duration per frame. * GES's multifilesource repeats the same problems mentioned above. Also, this source implement a "hacky" uri to be used as a GESUriClip. Propositions to solve those problems
Add a property using an array of image file names.
Add a property using an array of duration.
In case no array of duration is given,
Set a framerate through out a property.
In Gstreamer Editing Services, create:
GESImageSequenceClip
GESImageSequenceSource
Use cases / Possible users
* User who wants to create a script or application to render a video from a sequences of image files. * Handle image sequences as a *clip* in Gstreamer Editing Services, for editing purposes. Advantages ~~~~~~~~~~~ * Control over the filenames * Control over the duration of the frame * in Gstreamer editing services, treat imagesequencesrc as a GESClip, and having access to direct elements. Disadvantages ~~~~~~~~~~~~~ * Since gst-launch can´t parse an array of strings, it will not be possible to call imagesequencesrc throughout the pipeline using gst-launch. API Draft ~~~~~~~~~~ A. GstImageSequenceSrc Properties ---------- - filenames: G_TYPE_STRV) * Set an array of file names. * If this value has been already set, it will not be possible to set a new value. (new version maybe?) - durations: G_TYPE_INT * Set an array of duration per file name. * If this value or "framerate" value has been already set, it will not be possible to set a new value for whichever of both. - framerate: G_TYPE_FRACTION * Set the framerate for constant speed. * If this value or "durations" has been already set, it will not be possible to set a new value for whichever of both. B. GESImageSequenceSrc Properties ---------- Properties will be set throughout gst_track_element_set_child_property ... More Ideas (but need more development) ~~~~~~~~~~~ In order to play the sequence from gst-launch, there may be a playlist file. The playlist file can be a standard format such as m3u or pls. - The easiest way would be to add a property "playlist". It means that the element should typefind the playlist file and parsing it depending the format it is. - We could also think on a demuxer.>>>
If you agree with this proposal, I will modify GstImageSequenceSrc to work that way. Please, review it, and if there is something you think should be changed, tell me. If everything were okay for you, I will start to code.
I'm not fan of forcing the list of filename to be fully in RAM. Would it be acceptable to use a callback for the element to ask the application for the next filename ?
(In reply to Nicolas Dufresne (stormer) from comment 27)
I'm not fan of forcing the list of filename to be fully in RAM. Would it be
acceptable to use a callback for the element to ask the application for the
next filename ?
I also prefer that, I think I also proposed that on IRC at some point. A callback (returning a GstStructure with URI and duration?) plus for simplicity a printf-style URI like in multifilesink plus a framerate property. If no duration is known for a URI it would be based on the framerate, and the framerate is also what goes into the caps.
By this do you mean to emit a signal in gst_push_src_create function? If so, it means we are going to set the duration (and filename), every time we want to create a buffer. GES needs to know the duration of the source. How can we know the duration of source in this case?
What about this for starters: make a minimal element that only takes a printf-style URI and a framerate property? And then we can add all the other things on top of that and discuss them separately.