Gnonlin question: extract audio+video clip

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Gnonlin question: extract audio+video clip

Olivier Aubert-2
Hello

I am looking for a way to extract a video+audio clip from a video file.
The natural approach is to use gnonlin. I can extract the video with a
simple gst-launch command line:
gst-launch gnlfilesource name=video location=source.avi start=0 \
duration=5000000000 media-start=22000000000 media-duration=5000000000 ! \
identity single-segment=true ! progressreport update-freq=1 ! \
 ffmpegcolorspace ! theoraenc ! oggmux name=mux ! filesink location=/tmp/ex.ogv

However, combining video+audio is another matter. According to the
http://stackoverflow.com/questions/2481314/how-to-use-gnlcomposition-to-concatenate-video-files thread, I would need to use 2 gnlcompositions and  2 gnlfilesources to  achieve my goals. However, the following command line does not work:

gst-launch gnlfilesource name=video location=source.avi start=0 duration=5000000000 \
media-start=22000000000 media-duration=5000000000 ! identity single-segment=true \
! progressreport ! ffmpegcolorspace ! theoraenc ! oggmux name=mux \
! filesink location=/tmp/ex.ogv \
gnlfilesource name=audio location=source.avi start=0 duration=5000000000 \
media-start=22000000000 media-duration=5000000000 ! identity single-segment=true \
! vorbisenc ! queue ! mux.

and I think anyway that I should put a gnlcomposition in here, to keep
both streams in sync. Anyway, I feel that this is not achievable through
a gst-launch command-line, but would like to know if this feeling is
justified? Does anyone use a gst-launch command line to do such things?

Supplementary question: the remuxer.py from gst-python examples should
do this, but with some trickery (and I did not manage to get it to
successfully extract anything). Given its last real update dates back
from 2006, is it still considered as reference code?

Regards,
Olivier





------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gnonlin question: extract audio+video clip

Sandeep Prakash
Hi,

Olivier Aubert-2 wrote
I think anyway that I should put a gnlcomposition in here, to keep
both streams in sync.
Generally gnlcomposition is used when we join, say 2 video/audio streams.


Olivier Aubert-2 wrote
Does anyone use a gst-launch command line to do such things?
gst-launch can be used.

You need to set the caps for gnlfilesource in order to select the audio stream from avi.
Also use the "audioconvert" plugin to convert to a format that "vorbisenc" understands.
You can try the following command line:
gst-launch gnlfilesource name=video location=source.avi \
   start=0 duration=5000000000 media-start=22000000000 media-duration=5000000000 ! \
   identity single-segment=true ! progressreport ! ffmpegcolorspace ! theoraenc ! \
   oggmux name=mux ! filesink location=/tmp/ex.ogv gnlfilesource name=audio \
   caps="audio/x-raw-int" location=source.avi \
   start=0 duration=5000000000 media-start=22000000000 media-duration=5000000000 ! \
   identity single-segment=true ! audioconvert ! vorbisenc ! mux.


Regards,
Sandeep Prakash
http://sandeepprakash.homeip.net
Reply | Threaded
Open this post in threaded view
|

Re: Gnonlin question: extract audio+video clip

Edward Hervey
Administrator
In reply to this post by Olivier Aubert-2
Hi,

On Wed, 2010-07-28 at 19:08 +0200, Olivier Aubert wrote:

> Hello
>
> I am looking for a way to extract a video+audio clip from a video file.
> The natural approach is to use gnonlin. I can extract the video with a
> simple gst-launch command line:
> gst-launch gnlfilesource name=video location=source.avi start=0 \
> duration=5000000000 media-start=22000000000 media-duration=5000000000 ! \
> identity single-segment=true ! progressreport update-freq=1 ! \
>  ffmpegcolorspace ! theoraenc ! oggmux name=mux ! filesink location=/tmp/ex.ogv
>
> However, combining video+audio is another matter. According to the
> http://stackoverflow.com/questions/2481314/how-to-use-gnlcomposition-to-concatenate-video-files thread, I would need to use 2 gnlcompositions and  2 gnlfilesources to  achieve my goals. However, the following command line does not work:
>
> gst-launch gnlfilesource name=video location=source.avi start=0 duration=5000000000 \
> media-start=22000000000 media-duration=5000000000 ! identity single-segment=true \
> ! progressreport ! ffmpegcolorspace ! theoraenc ! oggmux name=mux \
> ! filesink location=/tmp/ex.ogv \
> gnlfilesource name=audio location=source.avi start=0 duration=5000000000 \
> media-start=22000000000 media-duration=5000000000 ! identity single-segment=true \
> ! vorbisenc ! queue ! mux.

  You need to specify which stream you want for each gnlfilesource by
using the 'caps' property.
  Ex : gnlfilesource caps="video/x-raw-yuv" ! ....

>
> and I think anyway that I should put a gnlcomposition in here, to keep
> both streams in sync. Anyway, I feel that this is not achievable through
> a gst-launch command-line, but would like to know if this feeling is
> justified? Does anyone use a gst-launch command line to do such things?

  You don't need a gnlcomposition if you're only using one file (like
you're doing above).

>
> Supplementary question: the remuxer.py from gst-python examples should
> do this, but with some trickery (and I did not manage to get it to
> successfully extract anything). Given its last real update dates back
> from 2006, is it still considered as reference code?
>
> Regards,
> Olivier
>
>
>
>
>
> ------------------------------------------------------------------------------
> The Palm PDK Hot Apps Program offers developers who use the
> Plug-In Development Kit to bring their C/C++ apps to Palm for a share
> of $1 Million in cash or HP Products. Visit us here for more details:
> http://p.sf.net/sfu/dev2dev-palm
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gnonlin question: extract audio+video clip

Olivier Aubert-2
Thanks to Edward and Sandeep. Here is, for the record, the pipeline
definition that allows to extract an A+V clip from a movie file:

SOURCE=source.avi
DEST=dest.ogv
BEGIN=25000 # start in ms
DURATION=5000 # duration in ms

gst-launch gnlfilesource name=video location=$SOURCE \
start=0 duration=${DURATION}000000 \
media-start=${BEGIN}000000 media-duration=${DURATION}000000 \
! identity single-segment=true ! progressreport update-freq=1 ! ffmpegcolorspace \
! theoraenc ! oggmux name=mux ! filesink location=${DEST} \
gnlfilesource name=audio caps="audio/x-raw-int" location=${SOURCE} \
start=0 duration=${DURATION}000000 \
media-start=${BEGIN}000000 media-duration=${DURATION}000000 \
! identity single-segment=true ! audioconvert ! vorbisenc ! mux.

Regards,
Olivier



------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gnonlin question: extract audio+video clip

shuyufu
Hi,

Recently, I try to play two video files as one (technically, I concatenate those files. Each file has different start, duration, media-start and media-duration) using gnonlin.

I found an example file (attached gnonlin-test.c) does exactly what I want and It works well. However, I got an error when I play the files using gst-launch.

Here is my gst-launch command:
gst-launch gnlcomposition name=comp \( gnlfilesource name=src1 location=big_buck_bunny_480p_h264.mov start=0 duration=10000000000 media-start=0 media-duration=10000000000 gnlfilesource name=src2 location=big_buck_bunny_480p_h264.mov start=10000000000 duration=10000000000 media-start=30000000000 media-duration=10000000000 \) ! ffmpegcolorspace ! autovideosink

It complains that
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...

(gst-launch-0.10:31803): GStreamer-WARNING **: adding flushing pad 'ghost0' to running element 'bin0', you need to use gst_pad_set_active(pad,TRUE) before adding it.
ERROR: from element /GstPipeline:pipeline0/GstBin:bin0/GnlFileSource:src1/GstURIDecodeBin:internal-uridecodebin/GstDecodeBin2:decodebin21/GstQTDemux:qtdemux1: GStreamer encountered a general stream error.
Additional debug info:
qtdemux.c(2980): gst_qtdemux_loop (): /GstPipeline:pipeline0/GstBin:bin0/GnlFileSource:src1/GstURIDecodeBin:internal-uridecodebin/GstDecodeBin2:decodebin21/GstQTDemux:qtdemux1:
streaming stopped, reason not-linked
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...


I don't understand why gst-launch complains "not-linked"?

Am I mis-understanding the gst-launch syntax? or gst-launch just can't?

Thank you for your time.