【发布时间】:2017-08-02 08:18:18
【问题描述】:
我有一个 MPEG-TS 文件,其中包含两个视频/音频流对:
$ gst-discoverer-1.0 Recorder_Aug01_12-30-39.ts
Analyzing Recorder_Aug01_12-30-39.ts
Done discovering Recorder_Aug01_12-30-39.ts
Topology:
container: MPEG-2 Transport Stream
audio: MPEG-2 AAC
audio: MPEG-4 AAC
video: H.264 (High Profile)
audio: MPEG-2 AAC
audio: MPEG-4 AAC
video: H.264 (High Profile)
Properties:
Duration: 0:01:49.662738259
Seekable: yes
Tags:
audio codec: MPEG-2 AAC
video codec: H.264
现在我想将第一个视频和音频流以及第二个视频/音频提取到两个单独的 MP4 容器中。
使用简单的管道并行显示两个视频流:
$ gst-launch-1.0 filesrc location=Recorder_Aug01_12-30-39.ts ! tsdemux name=ts \
ts.video_0_0102 ! queue ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! autovideosink \
ts.video_0_0100 ! queue ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! autovideosink
当我在一个流中引入mp4mux 和filesink 元素时,它仍然有效,显示第一个视频流并将第二个视频保存到 MP4 容器文件中:
$ gst-launch-1.0 filesrc location=Recorder_Aug01_12-30-39.ts ! tsdemux name=ts \
ts.video_0_0102 ! queue ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! ximagesink \
ts.video_0_0100 ! queue ! h264parse ! mp4mux ! filesink location=2.mp4
现在我的问题是:一旦我尝试通过文件接收器保存两个流,它就会失败:
$ gst-launch-1.0 filesrc location=Recorder_Aug01_12-30-39.ts ! tsdemux name=ts \
ts.video_0_0102 ! queue ! h264parse ! mp4mux ! filesink location=1.mp4 \
ts.video_0_0100 ! queue ! h264parse ! mp4mux ! filesink location=2.mp4
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstMP4Mux:mp4mux0: Could not multiplex stream.
Additional debug info:
gstqtmux.c(3486): gst_qt_mux_add_buffer (): /GstPipeline:pipeline0/GstMP4Mux:mp4mux0:
Buffer has no PTS.
Execution ended after 0:00:00.001992389
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
我想使用 gstreamer 来实现这一点,因为它稍后应该成为需要大量内省的更大处理工作流的一部分,因此无法选择使用 ffmpeg 或某些外部二进制文件。
【问题讨论】:
-
您可以使用
GST_DEBUG=3运行您的管道以获得更多日志吗?