GStreamer - how to convert .ts to .mkv or .mp4 with audio

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

GStreamer - how to convert .ts to .mkv or .mp4 with audio

fufu5000
This post was updated on .
Hi,I'm using RPi2 with Raspbian. I'm trying to find best solution for transcoding .ts files from tvheadend. At the moment the best is using Gstreamer because I can handle best performace. With Gssreamer I can transcode 1 minute .ts FHD video file to .mkv 480x270 in 30 secons which is in my opinion very good performance and I want to keep it.But I have problem with Gstreamer to make conversion .ts to mkv (or .mp4) with audio. Importand is that I have to have output video resized. Here is example which is working but no audio:

gst-launch-1.0 -v filesrc location=1.ts ! tsdemux parse-private-sections=false name=demux ! queue ! ac3parse ! matroskamux name=stream streamable=true demux. ! queue ! h264parse ! omxh264dec ! omxh264enc target-bitrate=1572864 control-rate=variable ! video/x-h264,stream-format=byte-stream,profile=high,width=480,height=270,framerate=25/1 ! h264parse ! filesink location=1.mkv

Here is another example which working, this time with with audio, but I can't resize video by changing omxh264enc parameters from example above:

gst-launch-1.0 filesrc location=1.ts ! decodebin name=demux demux. ! queue ! audioresample ! "audio/x-raw,rate=44100" ! audioconvert ! "audio/x-raw,format=F32LE" ! vorbisenc ! mux. matroskamux name=mux ! filesink location=1.mkv demux. ! queue ! videoconvert ! omxh264enc ! "video/x-h264,profile=high" ! h264parse ! mux.

Anyone has some command for gst-launch-1.0 to nice converting .ts to mkv (or mp4) with audio working?
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

AW: gstreamer - how to convert .ts to .mkv or .mp4 with sound

BGraaf

link the matroskamux to filesink and link the h264parse to .stream

 


Von: gstreamer-devel [mailto:[hidden email]] Im Auftrag von Kazuko Nakamura
Gesendet: Montag, 16. Oktober 2017 21:06
An: [hidden email]
Betreff: gstreamer - how to convert .ts to .mkv or .mp4 with sound

 

Hi,

 

I'm using RPi2 with Raspbian. I'm trying to find best solution for transcoding .ts files from tvheadend. At the moment the best is using Gstreamer because I can handle best performace. With Gssreamer I can transcode 1 minute .ts FHD video file to .mkv 480x270 in 30 secons which is in my opinion very good performance and I want to keep it.

 

But I have problem with Gstreamer to make conversion .ts to mkv (or .mp4) with audio. Importand is that I have to have output video resized. 

 

Here is example which is working but no audio:

 

[code]gst-launch-1.0 -v filesrc location=1.ts ! tsdemux parse-private-sections=false name=demux ! queue ! ac3parse ! matroskamux name=stream streamable=true demux. ! queue ! h264parse ! omxh264dec ! omxh264enc target-bitrate=1572864 control-rate=variable ! video/x-h264,stream-format=byte-stream,profile=high,width=480,height=270,framerate=25/1 ! h264parse ! filesink location=1.mkv[/code]

 

Here is another example which working, this time with with audio, but I can't resize video by changing omxh264enc parameters from example above:

 

[code]gst-launch-1.0 filesrc location=1.ts ! decodebin name=demux demux. ! queue ! audioresample ! "audio/x-raw,rate=44100" ! audioconvert ! "audio/x-raw,format=F32LE" ! vorbisenc ! mux. matroskamux name=mux ! filesink location=1.mkv demux. ! queue ! videoconvert ! omxh264enc ! "video/x-h264,profile=high" ! h264parse ! mux.[/code]

 

Anyone has some command for gst-launch-1.0 to nice converting .ts to mkv (or mp4) with audio working?


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AW: gstreamer - how to convert .ts to .mkv or .mp4 with sound

fufu5000
Thanks for advice!

From this example:

gst-launch-1.0 -v filesrc location=1.ts ! tsdemux
parse-private-sections=false name=demux ! queue ! ac3parse ! matroskamux
name=stream streamable=true demux. ! queue ! h264parse ! omxh264dec !
omxh264enc target-bitrate=1572864 control-rate=variable !
video/x-h264,stream-format=byte-stream,profile=high,width=480,height=270,framerate=25/1
! *h264parse* ! filesink location=1.mkv

If I change to *h264parse stream.* I have just audio with no video in 1.mkv
file. I don't know how to link the matroskamux to filesink



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

AW: AW: gstreamer - how to convert .ts to .mkv or .mp4 with sound

BGraaf
See example:
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/h
tml/gst-plugins-good-plugins-matroskamux.html


-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:[hidden email]]
Im Auftrag von fufu5000
Gesendet: Dienstag, 17. Oktober 2017 11:45
An: [hidden email]
Betreff: Re: AW: gstreamer - how to convert .ts to .mkv or .mp4 with sound

Thanks for advice!

From this example:

gst-launch-1.0 -v filesrc location=1.ts ! tsdemux
parse-private-sections=false name=demux ! queue ! ac3parse ! matroskamux
name=stream streamable=true demux. ! queue ! h264parse ! omxh264dec !
omxh264enc target-bitrate=1572864 control-rate=variable !
video/x-h264,stream-format=byte-stream,profile=high,width=480,height=270,fra
merate=25/1
! *h264parse* ! filesink location=1.mkv

If I change to *h264parse stream.* I have just audio with no video in 1.mkv
file. I don't know how to link the matroskamux to filesink



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AW: AW: gstreamer - how to convert .ts to .mkv or .mp4 with sound

fufu5000
So far no success.

I was trying to do that:

gst-launch-1.0 -v filesrc location=1.ts ! tsdemux
parse-private-sections=false name=demux ! queue ! ac3parse ! matroskamux
name=stream demux. ! filesink location=1.mkv demux. ! queue ! h264parse !
omxh264dec ! omxh264enc target-bitrate=1572864 control-rate=variable !
video/x-h264,stream-format=byte-stream,profile=high,width=480,height=270,framerate=25/1
! h264parse ! stream.

but doesn't work.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AW: AW: gstreamer - how to convert .ts to .mkv or .mp4 with sound

fufu5000
If I make that command:

gst-launch-1.0 filesrc location=1.ts \
! decodebin name=demux demux. \
! queue \
! audioresample \
! "audio/x-raw,rate=44100" \
! audioconvert \
! "audio/x-raw,format=F32LE" \
! vorbisenc \
! mux. matroskamux name=mux \
! filesink location=1.mkv demux. \
! queue \
! videoconvert \
! omxh264enc \
! "video/x-h264,profile=high" \
! h264parse \
! mux.

Working, but I can't resize video. For example if I change to:

!
"video/x-h264,stream-format=byte-stream,profile=high,width=480,height=270,framerate=25/1"

Gstreamer stops and 1.mkv has 0kb



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AW: AW: gstreamer - how to convert .ts to .mkv or .mp4 with sound

Ian Davidson
Perhaps you should include a videoscale in your pipeline to resize the
image.


On 17/10/2017 22:41, fufu5000 wrote:

> If I make that command:
>
> gst-launch-1.0 filesrc location=1.ts \
> ! decodebin name=demux demux. \
> ! queue \
> ! audioresample \
> ! "audio/x-raw,rate=44100" \
> ! audioconvert \
> ! "audio/x-raw,format=F32LE" \
> ! vorbisenc \
> ! mux. matroskamux name=mux \
> ! filesink location=1.mkv demux. \
> ! queue \
> ! videoconvert \
> ! omxh264enc \
> ! "video/x-h264,profile=high" \
> ! h264parse \
> ! mux.
>
> Working, but I can't resize video. For example if I change to:
>
> !
> "video/x-h264,stream-format=byte-stream,profile=high,width=480,height=270,framerate=25/1"
>
> Gstreamer stops and 1.mkv has 0kb
>

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AW: AW: gstreamer - how to convert .ts to .mkv or .mp4 with sound

fufu5000
Thanks Ian,

Is some progress :)

This command is working:

gst-launch-1.0 filesrc location=1.ts \
! decodebin name=demux demux. \
! queue \
! audioresample \
! "audio/x-raw,rate=44100" \
! audioconvert \
! "audio/x-raw,format=F32LE" \
! vorbisenc \
! mux. matroskamux name=mux \
! filesink location=1.mkv demux. \
! queue \
! videoconvert \
! videoscale \
! omxh264enc target-bitrate=1572864 control-rate=variable \
!
video/x-h264,stream-format=byte-stream,profile=high,width=480,height=270,framerate=25/1
\
! h264parse \
! mux.

Video is with changed bitrate and is scalled to 480x270

But.... Now I have problem with performance on RPi2. If I take above
command, transcoding 40 seconds .ts file takes about 4 minutes.

If I take this command on the same .ts file:

gst-launch-1.0 -v filesrc location=1.ts \
! tsdemux parse-private-sections=false name=demux \
! queue \
! ac3parse \
! matroskamux name=stream streamable=true demux. \
! queue \
! h264parse \
! omxh264dec \
! omxh264enc target-bitrate=1572864 control-rate=variable \
!
video/x-h264,stream-format=byte-stream,profile=high,width=480,height=270,framerate=25/1
\
! h264parse \
! filesink location=1.mkv

conversion takes just 20 seconds.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AW: AW: gstreamer - how to convert .ts to .mkv or .mp4 with sound

Ian Davidson
I suspect that the CPU is going flat out.  It is just possible that you
could do the scale before the convert and that it would make a
difference - but the problem is that each frame needs to be resized and
that takes a lot of CPU power.


On 18/10/2017 10:46, fufu5000 wrote:

> Thanks Ian,
>
> Is some progress :)
>
> This command is working:
>
> gst-launch-1.0 filesrc location=1.ts \
> ! decodebin name=demux demux. \
> ! queue \
> ! audioresample \
> ! "audio/x-raw,rate=44100" \
> ! audioconvert \
> ! "audio/x-raw,format=F32LE" \
> ! vorbisenc \
> ! mux. matroskamux name=mux \
> ! filesink location=1.mkv demux. \
> ! queue \
> ! videoconvert \
> ! videoscale \
> ! omxh264enc target-bitrate=1572864 control-rate=variable \
> !
> video/x-h264,stream-format=byte-stream,profile=high,width=480,height=270,framerate=25/1
> \
> ! h264parse \
> ! mux.
>
> Video is with changed bitrate and is scalled to 480x270
>
> But.... Now I have problem with performance on RPi2. If I take above
> command, transcoding 40 seconds .ts file takes about 4 minutes.
>
> If I take this command on the same .ts file:
>
> gst-launch-1.0 -v filesrc location=1.ts \
> ! tsdemux parse-private-sections=false name=demux \
> ! queue \
> ! ac3parse \
> ! matroskamux name=stream streamable=true demux. \
> ! queue \
> ! h264parse \
> ! omxh264dec \
> ! omxh264enc target-bitrate=1572864 control-rate=variable \
> !
> video/x-h264,stream-format=byte-stream,profile=high,width=480,height=270,framerate=25/1
> \
> ! h264parse \
> ! filesink location=1.mkv
>
> conversion takes just 20 seconds.
>

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: GStreamer - how to convert .ts to .mkv or .mp4 with audio

dave clark
In reply to this post by fufu5000
i use Avdshare Video Converter to convert ts to mkv or mp4 with audio. you
can try it out.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AW: gstreamer - how to convert .ts to .mkv or .mp4 with sound

educationtry
In reply to this post by BGraaf
iDealshare VideoGo also works great to convert between TS, MKV, MP4, AVI,
MOV, WMV, etc with high video and audio quality.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel