[gst-devel] Fwd: Convert .mkv containers into .mp4 containers playable on a PS3 using gst-launch

Michael R. Head burner at suppressingfire.org
Sun Dec 16 00:11:48 CET 2007


Apologies for top post, but there's not a good place to insert this
post, since I don't have a direct response for your issue below.

I did come up with a solution a year ago that worked pretty well for
converting MKV into AVI (without recoding). This is what I did:


for file in *.mkv; do 
  newf=`echo ${file/.mkv/.avi}`;
  tmpf=`echo ${file/.mkv/.tmp.avi}`;
  gst-launch-0.10 -m -v -T filesrc location="${file}" ! \ 
    matroskademux name=d  d.audio_00 ! queue ! faad ! lame ! \
    m.audio_00  d.video_00 ! queue  ! m.video_00 avimux name=m ! \
    filesink location="${tmpf}"; 
  avidemux --force-b-frame --load "${tmpf}" --audio-codec COPY \
    --video-codec COPY --fps 23.976023 --rebuild-inex \
    --output-format AVI --save  "${newf}" --quit;
  rm "${tmpf}";
done

Perhaps that's useful to you?

mike

On Sat, 2007-12-15 at 23:40 +0100, Andreas Tunek wrote:
> ---------- Forwarded message ----------
> From: Andreas Tunek <andreas.tunek at gmail.com>
> Date: 2007-dec-15 23:11
> Subject: Re: [gst-devel] Convert .mkv containers into .mp4 containers
> playable on a PS3 using gst-launch
> To: Mark Nauwelaerts <manauw at skynet.be>
> 
> 
> If I add the identity element I get the following output:
> 
> 
>  gst-launch -v filesrc
> location=Shrek.the.Halls.720p.HDTV.AVC.AC3-GB.mkv ! matroskademux
> name=d  ffmux_mp4 name=m ! filesink location=test.mp4 d.video_00 !
> queue ! identity ! m.video_00 d.audio_00 ! queue ! identity !
> m.audio_00
> 
> ** (gst-launch-0.10:9581): WARNING **: Add decoder amv (111) please
> 
> //similar stuff
> 
> ** (gst-launch-0.10:9581): WARNING **: Add decoder adpcm_thp (69650) please
> Ställer in rörledningen till PAUSED...
> Rörledningen utför PREROLL...
> /pipeline0/identity0: last-message = "event   ******* (identity0:sink)
> E (type: 102, GstEventNewsegment, update=(boolean)false,
> rate=(double)1, applied_rate=(double)1,
> format=(GstFormat)GST_FORMAT_TIME, start=(gint64)0,
> stop=(gint64)1279776000000, position=(gint64)0;) 0x92b0ca0"
> /pipeline0/identity0: last-message = "event   ******* (identity0:sink)
> E (type: 118, taglist, video-codec=(string)H264,
> language-code=(string)und;) 0x92b0cc8"
> /pipeline0/queue0.sink: caps = video/x-h264,
> codec_data=(buffer)014d4033ffe10016674d40339a7602802dd0800001f480005dc0478c189c01000468eebc80,
> width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1,
> framerate=(fraction)1580417221/65891899
> /pipeline0/queue0.src: caps = video/x-h264,
> codec_data=(buffer)014d4033ffe10016674d40339a7602802dd0800001f480005dc0478c189c01000468eebc80,
> width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1,
> framerate=(fraction)1580417221/65891899
> /pipeline0/identity0.src: caps = video/x-h264,
> codec_data=(buffer)014d4033ffe10016674d40339a7602802dd0800001f480005dc0478c189c01000468eebc80,
> width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1,
> framerate=(fraction)1580417221/65891899
> /pipeline0/identity0.sink: caps = video/x-h264,
> codec_data=(buffer)014d4033ffe10016674d40339a7602802dd0800001f480005dc0478c189c01000468eebc80,
> width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1,
> framerate=(fraction)1580417221/65891899
> /pipeline0/identity0: last-message = "chain   *******
> (identity0:sink)i (1320 bytes, timestamp: 0:00:00.000000000, duration:
> 0:00:00.041692724, offset: -1, offset_end: -1, flags: 33) 0x9421618"
> /pipeline0/m.video_0: caps = video/x-h264,
> codec_data=(buffer)014d4033ffe10016674d40339a7602802dd0800001f480005dc0478c189c01000468eebc80,
> width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1,
> framerate=(fraction)1580417221/65891899
> 
> Pressing ctrl-c gives the following:
> 
> Caught interrupt -- handling interrupt.
> Interrupt: Stopping pipeline ...
> FEL: rörledningen vill inte utföra preroll.
> Ställer in rörledningen till NULL...
> /pipeline0/m.video_0: caps = NULL
> /pipeline0/identity0.src: caps = NULL
> /pipeline0/identity0.sink: caps = NULL
> /pipeline0/queue0.src: caps = NULL
> /pipeline0/queue0.sink: caps = NULL
> /pipeline0/d.audio_00: caps = NULL
> /pipeline0/d.video_00: caps = NULL
> FRIGÖR rörledning...
> 
> 
> I don't really know what all this means, but maybe someone else do?
> 
> /Andreas
> 
> 2007/12/8, Mark Nauwelaerts <manauw at skynet.be>:
> > identity is inserted the usual way
> > (it is just another element that does nothing to the data passing through
> > ---unless specifically asked otherwise--- but gives some info on what it
> > "sees").  Concretely, using the fragment below (in place of the current one)
> >
> > d.video_00 ! queue ! identity ! m.video_00 d.audio_00 ! queue ! identity !
> > m.audio_00
> >
> > should suffice. As gst-launch is being run with -v, you should get updates about
> > identity's last-message property, which holds the diagnostics info (evidently,
> > if needed, even more identity could be inserted at other places to show buffer
> > by buffer what is happening).
> >
> > Other thoughts and comments:
> > - After and/or beyond that, debug levels can be set/increased to have elements
> > show what is going on ...
> > - [at least some time ago, don't know now] ffmpeg's mp4 muxer may not always
> > produce "nice results", depending on whichever piece of software player or
> > hardware is used to play it (but I don't use any mp4, so ... ?)
> > - framerate given below looks "not normal"
> > - in "more normal" operation, I would also expect to see more ... caps =
> > lines in the output
> >
> > Regards,
> > Mark.
> >
> > Andreas Tunek wrote:
> > > 2007/12/8, Mark Nauwelaerts <manauw at skynet.be>:
> > >> It is possible (though somewhat exotic) for the muxer to become "stuck" if the
> > >> incoming streams do not have proper (= nicely sequential and balanced)
> > >> timestamps.  You could try to verify this by inserting an identity element
> > >> (after each queue) and see what it reports.
> > >> This would also tell how far (#buffers) the pipeline really got).
> > >>
> > >
> > > How do you insert an identity element?
> > >
> > >> Also, matroskademux is not quite forthcoming in its error reporting.
> > >> If it runs into some error, it will pause its task without sending any
> > >> message/notification (unlike avimux in this regard)
> > >> [it does send an EOS which normally should clear downstream blocking and finish
> > >> things, but you never know ...]
> > >>
> > >> Regards,
> > >> Mark.
> > >
> > > Thanks for the help.
> > > Andreas
> > >> Andreas Tunek wrote:
> > >>> Is there really no way to transcode a .mkv to a .mp4 using gst-launch?
> > >>>
> > >>> 2007/12/3, Andreas Tunek <andreas.tunek at gmail.com>:
> > >>>> Using
> > >>>>
> > >>>> gst-launch -v filesrc location=heroes.s02e07.720p.hdtv.x264-nbs.mkv !
> > >>>> matroskademux name=d  ffmux_mp4 name=m ! filesink
> > >>>> location=heroes.s2.7.mp4 d.video_00 ! queue ! m.video_00 d.audio_00 !
> > >>>> queue ! m.audio_00
> > >>>>
> > >>>> it stops here:
> > >>>> Ställer in rörledningen till PAUSED...
> > >>>> Rörledningen utför PREROLL...
> > >>>> /pipeline0/queue0.sink: caps = video/x-h264,
> > >>>> codec_data=(buffer)01640033ffe1001867640033ac721c05005ba100000303e90000bb808f18319e01000468eebcb0,
> > >>>> width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1,
> > >>>> framerate=(fraction)1710843747/71356439
> > >>>> /pipeline0/queue0.src: caps = video/x-h264,
> > >>>> codec_data=(buffer)01640033ffe1001867640033ac721c05005ba100000303e90000bb808f18319e01000468eebcb0,
> > >>>> width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1,
> > >>>> framerate=(fraction)1710843747/71356439
> > >>>> /pipeline0/m.video_0: caps = video/x-h264,
> > >>>> codec_data=(buffer)01640033ffe1001867640033ac721c05005ba100000303e90000bb808f18319e01000468eebcb0,
> > >>>> width=(int)1280, height=(int)720, pixel-aspect-ratio=(fraction)1/1,
> > >>>> framerate=(fraction)1710843747/71356439
> > >>>>
> > >>>> Any help?
> > >>>>
> > >>>> 2007/12/1, Andreas Tunek <andreas.tunek at gmail.com>:
> > >>>>> Thanks for your help. Unfortunately I still have problems.....
> > >>>>>
> > >>>>> 2007/11/28, Edward Hervey <bilboed at gmail.com>:
> > >>>>>> On Wed, 2007-11-28 at 19:17 +0100, Andreas Tunek wrote:
> > >>>>>>> Hi Gstreamers
> > >>>>>>   We Stream the G !
> > >>>>>>
> > >>>>>>> I am sorry if this is the wrong list for this question, if so, please
> > >>>>>>> direct me to the correct list.
> > >>>>>>>
> > >>>>>>> I have a PS3 sitting next to my beautiful plasma TV. I use the PS3
> > >>>>>>> browser to download mpeg2 movies from my own server at home and view
> > >>>>>>> them using the PS3, but unfortunately most media I want to watch is
> > >>>>>>> not in mpeg2 format.
> > >>>>>>>
> > >>>>>>> The PS3 is supposed to be able to play h264 video and aac audio and is
> > >>>>>>> also supposed to be able to use the .mp4 container.
> > >>>>>>>
> > >>>>>>> Most of the media I would want to watch are .mkv files with h264
> > >>>>>>> encoded video and aac audio and I was wondering if anyone has any luck
> > >>>>>>> to remux the .mkv to a .mp4 using gst-launch? When I asked this on
> > >>>>>>> #gstreamer on freenode some helpful person (sorry, I forgot your
> > >>>>>>> name...) gave me this pipeline:
> > >>>>>>>
> > >>>>>>>  gst-launch filesrc location=heroes.s02e07.720p.hdtv.x264-nbs.mkv !
> > >>>>>>> matroskademux name=d  ffmux_mp4 name=m ! filesink
> > >>>>>>> location=heroes.s2.7.mp4 m.video00 ! queue ! video00 audio00 ! queue !
> > >>>>>>> d.audio00
> > >>>>>> Put your various parts one after the other and you'll see your (syntax)
> > >>>>>> error :
> > >>>>>>
> > >>>>>> filesrc ! matroskademux name=d
> > >>>>>> ffmux_mp4 name=m ! filesink
> > >>>>>>
> > >>>>>> Now you want to connect the two together.
> > >>>>>>  matroskademux has pads with names 'video_%02d' or 'audio_%02d', that
> > >>>>>> means that the first audio and video pad will be video_00 and audio_00.
> > >>>>>>  Using the same logic for ffmux_mp4, we have video_00 and audio_00
> > >>>>>>
> > >>>>>>  Which gives us :
> > >>>>>>
> > >>>>>> d.video_00 ! queue ! m.video_00
> > >>>>>> d.audio_00 ! queue ! m.audio_00
> > >>>>>>
> > >>>>>>
> > >>>>>>   I'll let you figure out where your errors were and reconstruct the
> > >>>>>> whole pipeline.
> > >>>>>>
> > >>>>> I made the following pipeline:
> > >>>>> gst-launch filesrc location=heroes.s02e07.720p.hdtv.x264-nbs.mkv !
> > >>>>> matroskademux name=d  ffmux_mp4 name=m ! filesink
> > >>>>> location=heroes.s2.7.mp4 d.video_00 ! queue ! m.video_00 d.audio_00 !
> > >>>>> queue ! m.audio_00
> > >>>>>
> > >>>>> I get a lot of warnings like
> > >>>>>
> > >>>>> ** (gst-launch-0.10:2695): WARNING **: Add decoder imc (86046) please
> > >>>>>
> > >>>>> ** (gst-launch-0.10:2695): WARNING **: Add decoder libgsm (86037) please
> > >>>>>
> > >>>>> ** (gst-launch-0.10:2695): WARNING **: Add decoder libgsm_ms (86049) please
> > >>>>>
> > >>>>> but then I get
> > >>>>>
> > >>>>> Ställer in rörledningen till PAUSED...
> > >>>>> Rörledningen utför PREROLL... (pipeline is doing Preroll)
> > >>>>>
> > >>>>> And this is all that is happening. The output file is 0 byte.
> > >>>>>
> > >>>>> Is there an error in my pipeline or is there another problem?
> > >>>>>
> > >>>>> I tried this on F8 wit Livna packages.
> > >>>>>
> > >>>>> Regards
> > >>>>> tuna
> > >>>>>
> > >>>>>>> However, when I run the above pipeline it complains that there is no
> > >>>>>>> video00-element.
> > >>>>>>>
> > >>>>>>> I am running Fedora 7 with freshrpms, but I can try it on F8 with Livna as well.
> > >>>>>>>
> > >>>>>>> Have anyone successfully remuxed files and played them on a PS3 using
> > >>>>>>> gst-launch? If so, could you please post the gst-launch pipeline you
> > >>>>>>> are using?
> > >>>>>>>
> > >>>>>>> Are there any other tools I should use, maybe there is something
> > >>>>>>> convenient I have missed?
> > >>>>>>>
> > >>>>>>> Best regards
> > >>>>>>>
> > >>>>>>> tuna
> > >>>>>>    Edward
> > >>>>>>
> > >>>>>>> -------------------------------------------------------------------------
> > >>>>>>> SF.Net email is sponsored by: The Future of Linux Business White Paper
> > >>>>>>> from Novell.  From the desktop to the data center, Linux is going
> > >>>>>>> mainstream.  Let it simplify your IT future.
> > >>>>>>> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
> > >>>>>>> _______________________________________________
> > >>>>>>> gstreamer-devel mailing list
> > >>>>>>> gstreamer-devel at lists.sourceforge.net
> > >>>>>>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> > >>> -------------------------------------------------------------------------
> > >>> SF.Net email is sponsored by:
> > >>> Check out the new SourceForge.net Marketplace.
> > >>> It's the best place to buy or sell services for
> > >>> just about anything Open Source.
> > >>> http://sourceforge.net/services/buy/index.php
> > >>> _______________________________________________
> > >>> gstreamer-devel mailing list
> > >>> gstreamer-devel at lists.sourceforge.net
> > >>> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services
> for just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
-- 
Michael R. Head <burner at suppressingfire.org>
http://picasaweb.google.com/demiri.head.wedding
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3259 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20071215/a21bdd70/attachment.bin>


More information about the gstreamer-devel mailing list