Using avprobe to examine one ts file i have this:
Input #0, mpegts, from '/tmp/file.ts':
Duration: 00:00:17.06, start: 82902.417489, bitrate: 3533kb/s
Program 30601
Program 30602
Program 30603
Program 30604
Program 30605
Program 30606
Program 30607
Program 30608
Program 30609
Program 30610
Program 30611
Stream #0.0[0xa0]: Video: mpeg2video (Main), yuv420p, 720x576 [PAR 64:45 DAR 16:9], 7647 kb/s, 25 fps, 90k tbn, 50 tbc
Stream #0.1[0x50](spa): Audio: mp2, 48000 Hz, 2 channels, s16p, 128 kb/s (clean effects)
Stream #0.2[0x51](dos): Audio: mp2, 48000 Hz, 2 channels, s16p, 128 kb/s (clean effects)
Stream #0.3[0xd0]: Data: [192][0][0][0] / 0x00C0
Stream #0.4[0xde]: Data: [192][0][0][0] / 0x00C0
Stream #0.5[0xd5]: Data: [193][0][0][0] / 0x00C1
Stream #0.6[0xfd]: Data: [193][0][0][0] / 0x00C1
Stream #0.7[0x133]: Data: [193][0][0][0] / 0x00C1
Stream #0.8[0x164]: Data: [193][0][0][0] / 0x00C1
Stream #0.9[0x188]: Data: [193][0][0][0] / 0x00C1
Stream #0.10[0x135]: Data: [192][0][0][0] / 0x00C0
Stream #0.11[0x276]: Data: [193][0][0][0] / 0x00C1
Stream #0.12[0x378]: Data: [193][0][0][0] / 0x00C1
Program 30612
I am testing this command to transcode to mp4 over the network one test ts file and it works fine but using default video and audio stream of program 30611:
gst-launch-1.0 filesrc location=/tmp/file.ts ! \
tsdemux program-number=30611 name=demux demux. ! \
queue ! \
mpegvideoparse ! \
omxmpeg2videodec ! \
queue ! \
omxh264enc ! \
video/x-h264,stream-format=byte-stream,profile=high,framerate=25/1 ! \
h264parse config-interval=1 ! \
mpegtsmux name=mux ! \
tcpserversink host=ipaddress port=port demux. ! \
queue ! \
mpegaudioparse ! \
mpg123audiodec ! \
audioconvert dithering=0 ! \
audio/x-raw,channels=1 ! \
avenc_mp2 bitrate=32768 ! \
mux.
But i would like to select first or second audio stream. I can't find on documentation or internet how to do it. Could you help me please?
This worked on my raspberry pi 2 with mpeg2 hardware decoder license enabled, you have to buy code license:
nohup gst-launch-1.0 filesrc location=/tmp/file.ts ! \
tsdemux name=demux demux.${VIDEOSELTXT} ! \
queue ! \
mpegvideoparse ! \
omxmpeg2videodec !
queue !
omxh264enc !
video/x-h264,stream-format=byte-stream,profile=high,width=360,height=288,framerate=25/1 !
h264parse config-interval=1 !
mpegtsmux name=mux !
tcpserversink host=${IP2LISTEN} port=${PORT2LISTEN} demux.${AUDIOSELTXT} !
queue !
mpegaudioparse !
mpg123audiodec !
audioconvert dithering=0 ! \
audio/x-raw,channels=1 ! \
avenc_mp2 bitrate=32768 ! \
mux. > /tmp/sal.log &
On our previous example change video variable:
VIDEOSELTXT for video_00a0
and audio variable:
AUDIOSELTXT for audio_0050 to spa audio stream
for audio_0051 to dos audio stream
On my tests it is only working using four numbers for audio and video stream, following examples are not working fine:
audio_00050
audio_50