以下管道产生一个3kb .ogg文件(我假设它只是一个空容器):
gst-launch-1.0 --gst-debug=3 filesrc location=test.raw
! 'audio/x-raw, format=S16LE, channels=1, rate=32000'
! audioconvert
! vorbisenc
! oggmux
! filesink location=test.ogg
这是调试输出:
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
0:00:00.048490941 813 0x556bf3625000 FIXME basesink gstbasesink.c:3077:gst_base_sink_default_event:<filesink0> stream-start event without group-id. Consider implementing group-id handling in the upstream elements
0:00:00.048541997 813 0x556bf3625000 WARN audioencoder gstaudioencoder.c:985:gst_audio_encoder_finish_frame:<vorbisenc0> Can't copy metadata because input buffer disappeared
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:00.139954729 813 0x556bf3625000 WARN basesrc gstbasesrc.c:2400:gst_base_src_update_length:<filesrc0> processing at or past EOS
Got EOS from element "pipeline0".
Execution ended after 0:00:00.091883401
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
当我添加这个wav编码/解码时,我得到一个好的.ogg文件:
gst-launch-1.0 --gst-debug=3 filesrc location=test.raw
! 'audio/x-raw, format=S16LE, channels=1, rate=32000'
! audioconvert
! wavenc
! wavparse
! audioconvert
! vorbisenc
! oggmux
! filesink location=test.ogg
调试输出:
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Redistribute latency...
0:00:00.135676651 822 0x562b3cd64770 FIXME basesink gstbasesink.c:3077:gst_base_sink_default_event:<filesink0> stream-start event without group-id. Consider implementing group-id handling in the upstream elements
0:00:00.135718946 822 0x562b3cd64770 WARN audioencoder gstaudioencoder.c:985:gst_audio_encoder_finish_frame:<vorbisenc0> Can't copy metadata because input buffer disappeared
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:00.219188746 822 0x562b3cd64770 WARN wavenc gstwavenc.c:795:gst_wavenc_write_toc:<wavenc0> have no toc
Got EOS from element "pipeline0".
Execution ended after 0:00:00.083921991
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
所以我的问题是:什么是第二个管道,有wavenc! wavparse,假设第一个缺失并且有更直接的方式来指定它,或者第二种形式实际上是“正确”的方式吗?
答案 0 :(得分:0)
第一个管道很好,因为它适用于testaudiosrc(audio / x-raw-int) 我假设您的未压缩音频文件必须是未压缩的WAV文件。
https://en.wikipedia.org/wiki/List_of_codecs#Audio_compression_formats
Wavenc可能正在预处理LPCM并转换为vorbisenc可以使用的东西。我怀疑vorbisenc的数据宽度需要为32或64,这可能是showstopper。
PCM签名的16位小端(S16LE)&gt;
audioconvert - 将音频转换为不同的格式(in:audio / x-raw-int out:audio / x-raw-int)
wavenc - 将原始音频编码为WAV(in:audio / x-raw-int out:audio / x-wav)
wavparse - 将.wav文件解析为原始音频(in:audio / x-wav out:audio / x-raw-float width:{32,64})
vorbisenc - 以Vorbis格式编码音频(in:audio / x-raw-float out:audio / x-vorbis)
gst-launch audiotestsrc num-buffers=50 \
! vorbisenc \
! oggmux \
! filesink location=test.ogg
play test.ogg
附录:我下载了您的文件,并确认您正在进行从16位到32位的未实现流转换。 Vorbisenc只接受32位宽度。要回答你原来的问题,不,你不需要wavparsing。这是您正在寻找的高效管道,简化了宽度转换。
gst-launch --gst-debug=2 filesrc location=test.raw \
! audio/x-raw-int, width=16, channels=2, depth=16, rate=16000, endianness=1234, signed=true \
! audioconvert \
! audio/x-raw-float, width=32, channels=2, rate=16000, endianness=1234, signed=true \
! vorbisenc \
! oggmux \
! filesink location=test.ogg