<html><head><style>pre,code,address {
margin: 0px;
}
h1,h2,h3,h4,h5,h6 {
margin-top: 0.2em;
margin-bottom: 0.2em;
}
ol,ul {
margin-top: 0em;
margin-bottom: 0em;
}
blockquote {
margin-top: 0em;
margin-bottom: 0em;
}
</style></head><body><div>Le lundi 07 août 2023 à 20:07 +0900, geysee via gstreamer-devel a écrit :</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div><span style=" font-size:10pt;font-family:sans-serif">Hi,</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">Mr. Nicolas.</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif">I'm Kamiya.</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif">I'm trying to combine multiple files with the splitmuxsrc signal "format_location" you advised.</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">I haven't tried concat element yet. I thought that splitmuxsrc would be more suitable because of the large number of files.</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif">It succeeded when the return value of GStrv* type was initialized as an array.(code below)</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif">-----------------------------</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">static GStrv* formatLocationHandler(GstElement *splitmux, gpointer udata)</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">{</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif"> gchar *locations[4];</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif"> locations[0] = g_strdup("C:/Rec/2023/07/26/1808_28911.mp4");</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif"> locations[1] = g_strdup("C:/Rec/2023/07/26/1808_38919.mp4");</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif"> locations[2] = g_strdup("C:/Rec/2023/07/26/1808_47902.mp4");</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif"> locations[3] = nullptr;</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif"> GStrv *ret = (GStrv*)g_new0(GStrv, 1);</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif"> std::memcpy(ret, &locations, sizeof(locations));</span></div></blockquote><div><br></div><div>You have 1 pointer allocated, but memcopy 4, this is going to overflow.</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif"> return ret;</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">}</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">-----------------------------</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif">On the other hand, if the return value was dynamically allocated, it will be crashed after exiting formatLocationHandler.(code below)</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif">-----------------------------</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">static GStrv* formatLocationHandler(GstElement *splitmux, gpointer udata)</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">{</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif"> gchar **locations = (gchar**)g_new0(gchar*, 4);</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif"> locations[0] = g_strdup("C:/Rec/2023/07/26/1808_28911.mp4");</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif"> locations[1] = g_strdup("C:/Rec/2023/07/26/1808_38919.mp4");</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif"> locations[2] = g_strdup("C:/Rec/2023/07/26/1808_47902.mp4");</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif"> locations[3] = nullptr;</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif"> GStrv *ret = (GStrv*)g_new0(GStrv, 1);</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif"> std::memcpy(ret, &locations, sizeof(locations));</span></div></blockquote><div><br></div><div>Same bug, it just worked by accident previously.</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif"> return ret;</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">}</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">-----------------------------</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif">Could you tell me how to dynamically allocate the file list in formatLocationHandler ?</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">I am very embarrassed that it may be a basic problem with C language or GLib, but I have been unable to solve it for a long time, so I would appreciate your help.</span></div>
<div><br></div><div><br><span style=" font-size:10pt;font-family:sans-serif">Best regards,</span></div>
<div><br><span style=" font-size:10pt;font-family:sans-serif">Kamiya.</span></div>
<div><br></div><div><br></div><div><br><tt><span style=" font-size:10pt">SHIGEHARU KAMIYA/TOA wrote on 2023/08/03 12:04:11:</span></tt></div>
<div><br><tt><span style=" font-size:10pt">> <br>> Hi,</span></tt></div>
<div><br><tt><span style=" font-size:10pt">> Mr. Nicolas.</span></tt></div>
<div><br><tt><span style=" font-size:10pt">> <br>> Thank you for your reply.</span></tt></div>
<div><br><tt><span style=" font-size:10pt">> Your way looks nice!</span></tt></div>
<div><br><tt><span style=" font-size:10pt">> <br>> I am trying it now.</span></tt></div>
<div><br><tt><span style=" font-size:10pt">> I will let you know the results later.</span></tt></div>
<div><br><tt><span style=" font-size:10pt">> <br>> Thank you.</span></tt></div>
<div><br><tt><span style=" font-size:10pt">> Kamiya.</span></tt></div>
<div><br><tt><span style=" font-size:10pt">> <br>> "gstreamer-devel" <gstreamer-devel-bounces@lists.freedesktop.org><br>> wrote on 2023/08/03 07:09:52:<br></span></tt></div>
<div><br><tt><span style=" font-size:10pt">> > <br>> > Hi,<br></span></tt></div>
<div><br><tt><span style=" font-size:10pt">> > Le mar. 1 août 2023, 03 h 15, geysee via gstreamer-devel <<br>> > gstreamer-devel@lists.freedesktop.org> a écrit :<br></span></tt></div>
<div><br><tt><span style=" font-size:10pt">> > > Hello<br>> > > I am Kamiya.<br>> > ><br>> > > I have a question.<br>> > ><br>> > > Is it a good way to separate pipelines in order to dynamically change<br>> > > properties<br>> > > that cannot be changed in the PLAYING state, such as the location property<br>> > > in filesrc?<br></span></tt></div>
<div><br><tt><span style=" font-size:10pt">> > <br>> > It can be a good method. But from what you described below, you may get<br>> > easier results with concat element instead. splitmuxsrc should work, there<br>> > is a signal to query the filename from your app instead of using the glob.<br></span></tt></div>
<div><br><tt><span style=" font-size:10pt">> > <br>> > ><br>> > > I'm sorry for the long post, but the background of the question is as<br>> > > follows.<br>> > ><br>> > ><br>> > > <br>> > <br>> ---------------------------------------------------------------------------------------------------------------------------------<br>> > > I'm making a system that records video from a network camera while<br>> > > dividing it into files.<br>> > > If the file is split at 10 minute intervals, the file path will be as<br>> > > follows.<br>> > ><br>> > > C:/Rec/2023/07/31/1330_00000.mp4<br>> > > C:/Rec/2023/07/31/1340_00000.mp4<br>> > > C:/Rec/2023/07/31/1350_00000.mp4<br>> > ><br>> > > With gstreamer C++ coding, I am trying to export as a single file by<br>> > > specifying the date and time range from the divided recording files.<br>> > ><br>> > > If the date and time range is in one file, like 13:32 - 13:34, then the<br>> > > pipeline below has been successful. (Properties are omitted)<br>> > ><br>> > > pileline : filesrc ! qtdemux ! h265parse ! queue ! qtmux ! filesink<br>> > ><br>> > > On the other hand, if the date and time range is split into multiple<br>> > > files, like 7/31 20:00 - 8/1 10:00, this pipeline fails.<br>> > ><br>> > > First, I tried multifilesrc and splitmuxsrc, but the location property is<br>> > > a glob pattern, it didn't fit the file path of date and time.<br>> > > Next, I tried updating the location property of filesrc sequentially, but<br>> > > I couldn't change the location when this state is PLAYING.<br>> > ><br>> > > So now I'm trying to divide the pipeline into two as follows.<br>> > ><br>> > > pipeline1 : filesrc ! qtdemux ! h265parse ! appsink<br>> > > pipeline2 : appsrc ! queue ! qtmux ! filesink<br>> > ><br>> > > When pipeline1 reaches the end of stream, I change the state of pipeline1<br>> > > to Ready.<br>> > > Next I change the location of filesrc. Finaly I change state to PLAYING<br>> > > again.<br>> > > The State of pipeline2 is not changed.<br>> > ><br>> > > However this way has not been successful yet. There are more problems than<br>> > > single pipeline.<br>> > ><br>> > > Currently looking into the following issues:<br>> > > If there was single pipeline it was processed at high speed, but if the<br>> > > pipeline is divided, the processing time will be as per the timestamp.<br>> > ><br>> > > Is it a good way to split the pipeline like this?<br>> > > I would appreciate if you give me some advice.<br>> > ><br>> > > <br>> > <br>> ---------------------------------------------------------------------------------------------------------------------------------<br>> > ><br>> > > Best regards,<br>> > > Kamiya.</span></tt></div>
<div><br></div></blockquote><div><br></div><div><span></span></div></body></html>