mp4mux faststart doesn't work (or how to properly stop a non-faststart pipeline)
k l
kludev at gmail.com
Sun Apr 21 14:44:30 PDT 2013
I have a pipeline that streams a webcam to an mp4 sink. I have the pipeline
as the following:
gst-launch -v --eos-on-shutdown souphttpsrc location="
http://192.168.0.20:81/video.cgi" do-timestamp=true is_live=true timeout=5
! multipartdemux ! jpegdec ! x264enc ! mp4mux faststart=true ! filesink
location="hi.mp4"
This would just stuck without producing any content. I debugged with
fakesink, the below is the output [1].
If I removed the faststart flag, it did produce a mp4 with contents. But
it's not playable, due to the reason that (I think) the metadata was not
written to the end of the file with me shutting the pipeline down with
ctrl-c. Here's a comparison at the end of the file it produced, with one
that's from a valid mp4 file[2].
I could use a non-faststart mp4mux. But I don't know how to shutdown the
pipeline gracefully in gst-launch so that the metadata is written to the
end of the file. I've tried starting gst-launch with -e option but no
difference.
Please help. Let me know if I need to further clarify my question.
K.
[1] fakesink's output with "faststart" option on
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstJpegDec:jpegdec0.GstPad:sink: caps = image/jpeg
/GstPipeline:pipeline0/GstJpegDec:jpegdec0.GstPad:src: caps =
video/x-raw-yuv, format=(fourcc)I420, width=(int)640, height=(int)480,
framerate=(fraction)0/1
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:src: caps = video/x-h264,
width=(int)640, height=(int)480, framerate=(fraction)0/1,
pixel-aspect-ratio=(fracti
on)1/1,
codec_data=(buffer)014d4016ffe10016674d4016dc0a03db0110000003001773594000f162f801000468eb8cb2,
stream-format=(string)avc, alignment=(string)au
/GstPipeline:pipeline0/GstX264Enc:x264enc0.GstPad:sink: caps =
video/x-raw-yuv, format=(fourcc)I420, width=(int)640, height=(int)480,
framerate=(fraction)0/1
/GstPipeline:pipeline0/GstMP4Mux:mp4mux0.GstPad:video_00: caps =
video/x-h264, width=(int)640, height=(int)480, framerate=(fraction)0/1,
pixel-aspect-ratio=(fra
ction)1/1,
codec_data=(buffer)014d4016ffe10016674d4016dc0a03db0110000003001773594000f162f801000468eb8cb2,
stream-format=(string)avc, alignment=(string)au
/GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps =
video/quicktime, variant=(string)iso
/GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "preroll
******* "
/GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "event
******* E (type: 118, taglist, container-format=(string)Multipart;)
025356A8"
/GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "event
******* E (type: 102, GstEventNewsegment, update=(boolean)false,
rate=(double)1, applied-r
ate=(double)1, format=(GstFormat)GST_FORMAT_BYTES, start=(gint64)0,
stop=(gint64)-1, position=(gint64)0;) 0252CB00"
/GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = "chain
******* < ( 0 bytes, timestamp: none, duration: none, offset: -1,
offset_end: -1, flags
: 0) 025374D8"
[2] Comparison at the end of the produced mp4 file
-------------
Produced without mp4mux's faststart option:
-------------
(...more data)
03d1c30: 977d c867 8550 59c7 1a7b 0732 876e 77e4 .}.g.PY..{.2.nw.
03d1c40: e787 e43a 73cf 2b59 be3f 4208 9b67 6073 ...:s.+Y.?B..g`s
03d1c50: e04f 5d4c 601f 0967 0cc4 70fa e3d3 302d .O]L`..g..p...0-
03d1c60: d3e7 eb90 f27c c784 c979 4979 5ca4 ba78 .....|...yIy\..x
03d1c70: a9b8 5f36 e748 4a50 7cf6 32b0 a5e9 fed3 .._6.HJP|.2.....
03d1c80: df77 dc95 b558 9c4c c9c5 c67c efda cc0f .w...X.L...|....
03d1c90: 5b09 38a5 f83e 35e0 c719 a1e3 c469 0393 [.8..>5......i..
03d1ca0: 869b e78c 35eb 4488 348e 2348 4bfb 6b11 ....5.D.4.#HK.k.
03d1cb0: ba7b 3188 762e e2d1 c93b e73f e9a4 27b3 .{1.v....;.?..'.
03d1cc0: 3866 6684 cdb8 4bec 60c5 9342 940b fd75 8ff...K.`..B...u
03d1cd0: 7b75 b27d 1764 750a 2089 5ec3 7d5a df13 {u.}.du. .^.}Z..
03d1ce0: 610d 4580 21b4 8504 15be 6799 dd2b cad8 a.E.!.....g..+..
03d1cf0: 114a 4c0b 5d21 3f79 5db0 3b42 6598 3ba7 .JL.]!?y].;Be.;.
03d1d00: 734e 798c 570b 6620 2da9 59a5 6c12 98ed sNy.W.f -.Y.l...
03d1d10: 1fed 4585 f74e a214 afba 7de0 c086 a7e0 ..E..N....}.....
03d1d20: 0a .
-----------------
A valid mp4 file (note the "Xmeta" thingy)
-----------------
...(more data)
00687a0: 0000 b300 0000 0100 0000 bc00 0000 0100 ................
00687b0: 0000 0000 0000 1473 7473 7300 0000 0000 .......stss.....
00687c0: 0000 0100 0000 0100 0000 1c73 7473 6300 ...........stsc.
00687d0: 0000 0000 0000 0100 0000 0100 0000 1200 ................
00687e0: 0000 0100 0000 5c73 7473 7a00 0000 0000 ......\stsz.....
00687f0: 0000 0000 0000 1200 009e 2200 00a3 b200 ..........".....
0068800: 0063 5f00 005c a300 0057 6d00 0059 4900 .c_..\...Wm..YI.
0068810: 005a cf00 0060 4700 0056 b300 0056 b200 .Z...`G..V...V..
0068820: 0054 3f00 0058 4d00 004e a600 0054 6700 .T?..XM..N...Tg.
0068830: 0057 7f00 004b 9600 0045 2c00 0031 f900 .W...K...E,..1..
0068840: 0000 1473 7463 6f00 0000 0000 0000 0100 ...stco.........
0068850: 0000 3000 0000 6075 6474 6100 0000 586d ..0...`udta...Xm
0068860: 6574 6100 0000 0000 0000 2168 646c 7200 eta.......!hdlr.
0068870: 0000 0000 0000 006d 6469 7261 7070 6c00 .......mdirappl.
0068880: 0000 0000 0000 0000 0000 002b 696c 7374 ...........+ilst
0068890: 0000 0023 a974 6f6f 0000 001b 6461 7461 ...#.too....data
00688a0: 0000 0001 0000 0000 4c61 7666 3533 2e32 ........Lavf53.2
00688b0: 322e 300a 2.0.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130421/ea15f64f/attachment.html>
More information about the gstreamer-devel
mailing list