gstreamer mux原始h264到mp4?

时间:2019-07-10 14:49:07

标签: gstreamer gstreamer-1.0

我通过ffmpeg创建任何示例流:

ffmpeg -f lavfi -i testsrc2=r=30:size=800x800:duration=10 -c:v libx264 -g 60 -bf 0 -f h264 test.264

然后我尝试重新混合流而无需重新编码:

$ gst-launch-1.0 -v --gst-debug=trace filesrc location=test.264 ! h264parse ! queue ! qtmux ! filesink location=rawh264tomp4.mp4

但是它无法多路复用流:

Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)800, height=(int)800, framerate=(fraction)30/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)3.1, codec_data=(buffer)0164001fffe100186764001facb2019032d80880000003008000001e078c192401000668ebc3cb22c0
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:sink: caps = video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)800, height=(int)800, framerate=(fraction)30/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)3.1, codec_data=(buffer)0164001fffe100186764001facb2019032d80880000003008000001e078c192401000668ebc3cb22c0
/GstPipeline:pipeline0/GstQueue:queue0.GstPad:src: caps = video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)800, height=(int)800, framerate=(fraction)30/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)3.1, codec_data=(buffer)0164001fffe100186764001facb2019032d80880000003008000001e078c192401000668ebc3cb22c0
/GstPipeline:pipeline0/GstQTMux:qtmux0.GstQTMuxPad:video_0: caps = video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)800, height=(int)800, framerate=(fraction)30/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)3.1, codec_data=(buffer)0164001fffe100186764001facb2019032d80880000003008000001e078c192401000668ebc3cb22c0
/GstPipeline:pipeline0/GstQTMux:qtmux0.GstPad:src: caps = video/quicktime, variant=(string)apple
/GstPipeline:pipeline0/GstFileSink:filesink0.GstPad:sink: caps = video/quicktime, variant=(string)apple
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstQTMux:qtmux0: Could not multiplex stream.
Additional debug info:
gstqtmux.c(4559): gst_qt_mux_add_buffer (): /GstPipeline:pipeline0/GstQTMux:qtmux0:
Buffer has no PTS.
Execution ended after 0:00:00.000111337
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

它说缓冲区没有PTS。 我也尝试了qtmux,同样的错误。

ffprobe结果如下:

{
Input #0, h264, from 'test.264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 800x800 [SAR 1:1 DAR 1:1], 30 fps, 30 tbr, 1200k tbn, 60 tbc
    "programs": [

    ],
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",
            "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
            "profile": "High",
            "codec_type": "video",
            "codec_time_base": "1/60",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 800,
            "height": 800,
            "coded_width": 800,
            "coded_height": 800,
            "has_b_frames": 0,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "1:1",
            "pix_fmt": "yuv420p",
            "level": 31,
            "chroma_location": "left",
            "field_order": "progressive",
            "refs": 1,
            "is_avc": "false",
            "nal_length_size": "0",
            "r_frame_rate": "30/1",
            "avg_frame_rate": "30/1",
            "time_base": "1/1200000",
            "bits_per_raw_sample": "8",
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            }
        }
    ],
    "format": {
        "filename": "test.264",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "h264",
        "format_long_name": "raw H.264 video",
        "size": "2516641",
        "probe_score": 51
    }
}

0 个答案:

没有答案