Gstreamer gst-launch-1.0 select 用于转码的音频流
Gstreamer gst-launch-1.0 select audio stream for transcoding
使用 avprobe 检查一个 ts 文件我有这个:
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
我正在测试此命令以通过网络将一个测试 ts 文件转码为 mp4,它工作正常但使用程序 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.
但我想 select 第一个或第二个音频流。我无法在文档或互联网上找到如何操作。你能帮帮我吗?
这适用于我的 raspberry pi 2,启用了 mpeg2 硬件解码器许可证,您必须购买代码许可证:
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 &
在我们之前的示例中更改视频变量:
VIDEOSELTXT for video_00a0
和音频变量:
AUDIOSELTXT for audio_0050 to spa audio stream
for audio_0051 to dos audio stream
在我的测试中,它只对音频和视频流使用四个数字,以下示例无法正常工作:
audio_00050
audio_50
使用 avprobe 检查一个 ts 文件我有这个:
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
我正在测试此命令以通过网络将一个测试 ts 文件转码为 mp4,它工作正常但使用程序 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.
但我想 select 第一个或第二个音频流。我无法在文档或互联网上找到如何操作。你能帮帮我吗?
这适用于我的 raspberry pi 2,启用了 mpeg2 硬件解码器许可证,您必须购买代码许可证:
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 &
在我们之前的示例中更改视频变量:
VIDEOSELTXT for video_00a0
和音频变量:
AUDIOSELTXT for audio_0050 to spa audio stream
for audio_0051 to dos audio stream
在我的测试中,它只对音频和视频流使用四个数字,以下示例无法正常工作:
audio_00050
audio_50