Gstreamer - converting .ts to mkv. No audio.

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

Gstreamer - converting .ts to mkv. No audio.

fufu5000
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?



--
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: Gstreamer - converting .ts to mkv. No audio.

Peter Maersk-Moller-2
Hi Kazuko.

Your first pipeline is missing linking output of h264parse to matroskamux and missing linking matroskamux to filesink. Perhaps something like

gst-launch-1.0 -v filesrc location=1.ts ! tsdemux
parse-private-sections=false name=demux ! queue ! ac3parse ! matroskamux
name=stream streamable=true ! queue ! 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.

For your second pipeline, which video size do you convert from and convert to? omxh264enc can only accept certain geometries (at least on RasPi).
Try convert to something likeĀ  480x288, but make sure you keep pixel aspect ratio of 1:1.

Regards
Peter Maersk-Moller


On Sun, Oct 15, 2017 at 10:01 PM, fufu5000 <[hidden email]> wrote:
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?



--
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: Gstreamer - converting .ts to mkv. No audio.

fufu5000
Hi,

I was experiment with command like yours before.

Looks that working but output file stops at couple kb and doesn't incerase
Gstreamer doesn't stops.



--
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: Gstreamer - converting .ts to mkv. No audio.

fufu5000
Finally I have command working !!!

This is syntax (queue changed to queue2):

gst-launch-1.0 -v filesrc location=1.ts \
! tsdemux parse-private-sections=false name=demux \
! queue2 \
! ac3parse \
! matroskamux name=stream streamable=true \
! queue2 \
! filesink location=1.mkv demux. \
! queue2 \
! 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.

Now.
This is important part:
Peter wrote: /"For your second pipeline, which video size do you convert
from and convert to? omxh264enc can only accept certain geometries (at least
on RasPi). Try convert to something like  480x288, but make sure you keep
pixel aspect ratio of 1:1."/

Input 1.ts file has video track (listing from ffmpeg):
Stream #0:0[0x2c8]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv,
bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc

Oryginal picture looks:
https://i.imgur.com/Jq8Cupj.png

When I resize to 480x270 picture has red lines on bottom:
https://i.imgur.com/24U8pCV.png

When I resize to 480x288, picture has wrong height aspect and looks like
this:
https://i.imgur.com/a1hh8UN.png

How to fix this? I would like to have 480p from 1920x1080.




--
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: Gstreamer - converting .ts to mkv. No audio.

fufu5000
Little update.

Probably better is change:

! queue \
to
! queue max-size-buffers=0 max-size-time=0 \

Also looks that resizing need aspect ratio 1,77777 for 1920x1080 and 1,25
for SD 720x576

Would be nice for me to find some deinterlace for previous post command, but
isn't necessary at the moment.






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