how to convert .mp4 to .ts use gst-launch-1.x

gang jiazaihaibian at hotmail.com
Sat Mar 21 18:40:05 PDT 2015


Hello, all,  I have a problem when I tried to conver a .mp4 file to .ts, here
is the detail:
------------------------------------
name$ avprobe why.mp4 
avprobe version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2007-2014 the
Libav developers
  built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'why.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2011-02-07 08:15:04
  Duration: 00:03:25.74, start: 0.000000, bitrate: 6000 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR
16:9], 5866 kb/s, 23.98 fps, 24 tbr, 1k tbn, 47.95 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
    Stream #0.1(und): Audio: aac, 44100 Hz, stereo, fltp, 127 kb/s
    Metadata:
      creation_time   : 2011-02-07 08:15:08
# avprobe output
------------------------------------

It looks everything is ok, so I use command:

*gst-launch-0.10 filesrc location=why.mp4 ! decodebin2 name=dec ! queue !
x264enc ! mpegtsmux name=mux ! filesink location=1.ts dec. ! queue !
audioconvert ! ffenc_aac ! mux.*

and the result is:
------------------------------------
name$ avprobe 1.ts 
avprobe version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2007-2014 the
Libav developers
  built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
[aac @ 0x23e4fa0] Input buffer exhausted before END element found
[mpegts @ 0x23ddc00] Non-increasing DTS in stream 0: packet 22 with DTS
86310, packet 23 with DTS 86310
[mpegts @ 0x23ddc00] Non-increasing DTS in stream 0: packet 25 with DTS
97560, packet 26 with DTS 97560
[mpegts @ 0x23ddc00] Non-increasing DTS in stream 0: packet 29 with DTS
112590, packet 30 with DTS 112590
[mpegts @ 0x23ddc00] Non-increasing DTS in stream 0: packet 75 with DTS
285300, packet 76 with DTS 285300
[mpegts @ 0x23ddc00] max_analyze_duration reached
Input #0, mpegts, from '1.ts':
  Duration: 00:03:25.70, start: 0.000000, bitrate: 2134 kb/s
  Program 1 
    Stream #0.0[0x41]: Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR
16:9], 23.42 fps, 1k tbr, 90k tbn, 1073741824 tbc
    Stream #0.1[0x40]: Audio: aac, 44100 Hz, stereo, fltp, 129 kb/s
[h264 @ 0x23e54a0] Ignoring NAL unit 9 during extradata parsing
# avprobe output
------------------------------------

also looks nice except some warnings, but when I use gst-launch-1.0(include
1.0.10, 1.2.4 and 1.4.5),
I used command :

*gst-launch-1.0 filesrc location=why.mp4 ! qtdemux name=dec ! queue !
avdec_h264 ! queue ! x264enc ! mpegtsmux name=mux ! filesink location=1.ts
dec. ! queue ! audioconvert ! avenc_aac ! mux.*

output:
------------------------------------
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
Redistribute latency...
------------------------------------
waited for ten minutes, nothing else...
but if I only transcode video, like:

 *gst-launch-1.0 filesrc location=why.mp4 ! qtdemux name=dec ! queue !
avdec_h264 ! queue ! x264enc ! mpegtsmux name=mux ! filesink
location=1.ts*(just delete audio process)

it works well, but start time of 1.ts is 3600:
------------------------------------
name$ avprobe 1.ts 
[mpegts @ 0xee7c60] Invalid timestamps stream=0, pts=324082620,
dts=324086310, size=2463
[mpegts @ 0xee7c60] Invalid timestamps stream=0, pts=324093870,
dts=324097560, size=2847
[mpegts @ 0xee7c60] Invalid timestamps stream=0, pts=324108900,
dts=324112590, size=2372
[mpegts @ 0xee7c60] Invalid timestamps stream=0, pts=324281520,
dts=324285210, size=4271
[mpegts @ 0xee7c60] Invalid timestamps stream=0, pts=324446670,
dts=324450540, size=2918
[mpegts @ 0xee7c60] Invalid timestamps stream=0, pts=324457920,
dts=324458010, size=6939
[mpegts @ 0xee7c60] Invalid timestamps stream=0, pts=324461700,
dts=324461790, size=7241
Input #0, mpegts, from '1.ts':
  Duration: 00:03:25.75,* start: 3600.000000*, bitrate: 1957 kb/s
  Program 1 
    Stream #0:0[0x41]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k 
tbn, 2000000000.00 tbc
------------------------------------

I there something wrong when I use gstreamer ? plz help me!



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/how-to-convert-mp4-to-ts-use-gst-launch-1-x-tp4671263.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list