<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi all,</blockquote><div><br></div><div>I have several input files encoded in H264 that are short ( 2 mn).</div>
<div>I would like to chain them and play it smoothly.</div><div><br></div><div>I saw three ways to do it :</div>
<div><br></div><div><b>1) Using playbin2</b></div><div><b><br></b></div><div>Listening to "about_to_finish" event and change the uri of the playbin2 pipeline then,</div><div><br></div><div>--> It works but I do not have a smooth transition when uri changement occurs</div>
<div><br></div><div><br></div><div><b>2) using gnlcomposition</b></div><div><br></div><div>I tried to set a pipeline with correct duration (2mn</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
GST_DEBUG=2 gst-launch-0.10 gnlcomposition name=comp gnlfilesource name=video1 location="./myfile.avi" start=0 duration=0 media-start=0 media-duration=120000000000 gnlfilesource name=video2 location="./myfile2.avi" start=120000000000 duration=240000000000 media-start=0 media-duration=120000000000 ! autovideosink</blockquote>
<div><br></div><div><br></div><div>I have the following error :</div><div><br></div><div>
<div>Définition du pipeline à PAUSED...</div><div>0:00:00.042206793 9639 0x1133050 WARN avidemux gstavidemux.c:<a href="tel:3744" value="+333744" target="_blank">3744</a>:gst_avi_demux_stream_header_pull:<avidemux0> Unknown tag RCOV in AVI header at off 9496</div>
<div>0:00:00.042530150 9639 0x1133050 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux0> invalid stream nr 560</div><div>0:00:00.042659018 9639 0x1133050 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux0> invalid stream nr 738</div>
<div>0:00:00.042758981 9639 0x1133050 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux0> invalid stream nr 738</div><div>0:00:00.042878288 9639 0x1133050 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux0> invalid stream nr 738</div>
<div>0:00:00.042984286 9639 0x1133050 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux0> invalid stream nr 738</div><div>0:00:00.043083517 9639 0x1133050 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux0> invalid stream nr 359</div>
<div>Le pipeline est en phase de PREROLL...</div><div>0:00:00.051146232 9639 0x11330f0 WARN avidemux gstavidemux.c:<a href="tel:3744" value="+333744" target="_blank">3744</a>:gst_avi_demux_stream_header_pull:<avidemux1> Unknown tag RCOV in AVI header at off 9496</div>
<div>0:00:00.051324655 9639 0x11330f0 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux1> invalid stream nr 560</div><div>0:00:00.051385497 9639 0x11330f0 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux1> invalid stream nr 738</div>
<div>0:00:00.051424734 9639 0x11330f0 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux1> invalid stream nr 738</div><div>0:00:00.051474771 9639 0x11330f0 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux1> invalid stream nr 738</div>
<div>0:00:00.051512985 9639 0x11330f0 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux1> invalid stream nr 738</div><div>0:00:00.051550250 9639 0x11330f0 WARN avidemux gstavidemux.c:2582:gst_avi_demux_stream_for_id:<avidemux1> invalid stream nr 359</div>
<div>0:00:00.179362043 9639 0x7f403c008990 WARN faad gstfaad.c:328:gst_faad_set_format:<faad0> buggy faad version, wrong nr of channels 2 instead of 1</div><div>0:00:00.191962359 9639 0x7f403c0088a0 WARN gnlsource gnlsource.c:213:element_pad_added_cb:<video2> We already have (pending) ghost-ed a valid source pad (ghostpad:'':'', pendingblock:1</div>
<div>0:00:00.204969320 9639 0x7f40280034a0 WARN faad gstfaad.c:328:gst_faad_set_format:<faad1> buggy faad version, wrong nr of channels 2 instead of 1</div><div>0:00:00.210988459 9639 0x7f4028003400 WARN gnlsource gnlsource.c:213:element_pad_added_cb:<video1> We already have (pending) ghost-ed a valid source pad (ghostpad:'':'', pendingblock:1</div>
<div>0:00:00.234065944 9639 0x7f4028003400 WARN ffmpeg gstffmpegdec.c:2315:gst_ffmpegdec_frame:<ffdec_h2641> ffdec_h264: decoding error (len: -1, have_data: 0)</div><div>0:00:00.234863079 9639 0x11330f0 WARN avidemux gstavidemux.c:5254:gst_avi_demux_loop:<avidemux1> error: Erreur interne de flux de données.</div>
<div>0:00:00.234953061 9639 0x11330f0 WARN avidemux gstavidemux.c:5254:gst_avi_demux_loop:<avidemux1> error: streaming stopped, reason not-linked</div><div>ERREUR : de l'élément /GstPipeline:pipeline0/GnlFileSource:video1/GstURIDecodeBin:internal-uridecodebin/GstDecodeBin2:decodebin21/GstAviDemux:avidemux1 : Erreur interne de flux de données.</div>
<div>Information de débogage supplémentaire :</div><div>gstavidemux.c(5254): gst_avi_demux_loop (): /GstPipeline:pipeline0/GnlFileSource:video1/GstURIDecodeBin:internal-uridecodebin/GstDecodeBin2:decodebin21/GstAviDemux:avidemux1:</div>
<div>streaming stopped, reason not-linked</div><div>ERREUR : le pipeline refuse de passer en phase de préparation.</div><div>Définition du pipeline à NULL...</div><div>0:00:00.246670995 9639 0x7f4028003400 WARN ffmpeg gstffmpegdec.c:2315:gst_ffmpegdec_frame:<ffdec_h2641> ffdec_h264: decoding error (len: -1, have_data: 0)</div>
<div>0:00:00.247565486 9639 0x7f4028003400 WARN ffmpeg gstffmpegdec.c:2315:gst_ffmpegdec_frame:<ffdec_h2641> ffdec_h264: decoding error (len: -1, have_data: 0)</div><div><br></div></div><div><br></div>
<div><b>3) Using appsrc</b></div><div><b><br></b></div><div>I can play a file using this method. I implemented a callback feed_data called when signal need_data occured.<br></div><div>I am using buffers of 4096.</div><div>
For testing, I am detecting when the last buffer would be used, i.e data to write to buffer less than 4096. Then I append to this buffer datas from my second file.</div><div>I also changed the timestamp. To see a relevant result for this testing, I increased chunk-size to 100*4096</div>
<div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> if (app->offset + len > app->length){<br>
len = app->length - app->offset;<br> GST_BUFFER_DATA (buffer) = app->data + app->offset;<br> GST_BUFFER_SIZE (buffer) = len;<br> GMappedFile* newfile = g_mapped_file_new ("./file2.avi", FALSE, &error);<br>
guint8 *newdata;<br> gsize newlength = CHUNK_SIZE - len;<br> GstBuffer *newbuffer;<br> GstBuffer *destbuffer;<br> if (error) {<br> g_print ("failed to open file: %s\n", error->message);<br>
g_error_free (error);<br> return -2;<br> }<br> //fill in the new buffer<br> newdata = (guint8 *) g_mapped_file_get_contents (newfile);<br> newbuffer = gst_buffer_new ();<br> GST_BUFFER_DATA (newbuffer) = newdata;<br>
GST_BUFFER_SIZE (newbuffer) = newlength;<br> // change timestamp<br> GST_BUFFER_TIMESTAMP(newbuffer) = GST_BUFFER_DURATION (buffer);<br> // hack for testing - wrong duration<br> GST_BUFFER_DURATION(newbuffer) = 500000000;<br>
//merge buffer<br> GST_BUFFER_MALLOCDATA (destbuffer) = g_malloc (CHUNK_SIZE);<br> GST_BUFFER_SIZE (destbuffer) = CHUNK_SIZE ;<br> destbuffer = gst_buffer_merge(buffer,newbuffer);<br> GST_BUFFER_DURATION (destbuffer)=GST_BUFFER_DURATION(buffer) + GST_BUFFER_DURATION(newbuffer);<br>
g_signal_emit_by_name (app->appsrc, "push-buffer", destbuffer, &ret);<br> gst_buffer_unref (destbuffer);</blockquote></div><div><br></div><div><br></div><div><br></div><div>All the time, the video is ending at the end of first file and a EOS is detected...</div>
<div><br></div><div><br></div><div>Could you tell me which way I should use and eventually help me to make it work !</div><div><br></div><div>Thanks a lot,</div><div><br></div><div>Eloi</div></div>