GNOME Bugzilla – Bug 723551
aacparse: convert mpeg-2 adts to mpeg-4 raw stream-format
Last modified: 2018-11-03 14:51:27 UTC
This is needed to stream AAC RTP stream demuxed from MPEG TS. I don't insist that exactly aacparse is guilty, just Sebastian Droege has said that aacparse is best place to perform that conversion. To reproduce: ffmpeg -f lavfi -i aevalsrc=0 -acodec aac -strict -2 -f mpegts - | GST_DEBUG=3,GST_CAPS:5,aacparse:8 gst-launch-1.0 -v fdsrc fd=0 ! tsdemux name=demux demux.audio_0100 ! aacparse ! rtpmp4apay ! fakesink The output: ffmpeg version N-60251-g7c756b6 Copyright (c) 2000-2014 the FFmpeg developers built on Jan 30 2014 21:37:23 with gcc 4.6.3 (Gentoo 4.6.3 p1.13, pie-0.5.2) configuration: --enable-gpl --enable-libx264 --enable-encoder=libx264 --disable-stripping --enable-debug --extra-cflags='-O0 -g -ggdb' --enable-libopus --enable-libvpx --enable-x11grab --enable-libfreetype --enable-filter=drawtext libavutil 52. 63.100 / 52. 63.100 libavcodec 55. 49.101 / 55. 49.101 libavformat 55. 28.101 / 55. 28.101 libavdevice 55. 7.100 / 55. 7.100 libavfilter 4. 1.101 / 4. 1.101 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 libpostproc 52. 3.100 / 52. 3.100 Input #0, lavfi, from 'aevalsrc=0': Duration: N/A, start: 0.000000, bitrate: 2822 kb/s Stream #0:0: Audio: pcm_f64le, 44100 Hz, mono, dbl, 2822 kb/s Output #0, mpegts, to 'pipe:': Metadata: encoder : Lavf55.28.101 Stream #0:0: Audio: aac, 44100 Hz, mono, fltp, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (pcm_f64le -> aac) Press [q] to stop, [?] for help [adts @ 0x20c6c00] Encoder did not produce proper pts, making some up. 0:00:00.023883839 26488 0x18e7d20 DEBUG aacparse gstaacparse.c:145:gst_aac_parse_init: initialized 0:00:00.024920422 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<fdsrc0:src> get pad caps with filter (NULL) 0:00:00.024963129 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<fdsrc0:src> query returned ANY 0:00:00.024977456 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<demux:sink> get pad caps with filter (NULL) 0:00:00.024991009 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2900:gst_pad_query_caps_default:<demux:sink> query caps caps query: 0x193af70, GstQueryCaps, filter=(GstCaps)"NULL", caps=(GstCaps)"NULL"; 0:00:00.025011698 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2923:gst_pad_query_caps_default:<demux:sink> trying pad template caps 0:00:00.025020716 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2953:gst_pad_query_caps_default:<demux:sink> using caps 0x193ab70 video/mpegts, systemstream=(boolean)true 0:00:00.025035098 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<demux:sink> query returned video/mpegts, systemstream=(boolean)true 0:00:00.025067199 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<fdsrc0:src> get pad caps with filter (NULL) 0:00:00.025082638 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<fdsrc0:src> query returned ANY 0:00:00.025093574 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<demux:sink> get pad caps with filter (NULL) 0:00:00.025104619 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2900:gst_pad_query_caps_default:<demux:sink> query caps caps query: 0x1a3b850, GstQueryCaps, filter=(GstCaps)"NULL", caps=(GstCaps)"NULL"; 0:00:00.025118772 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2923:gst_pad_query_caps_default:<demux:sink> trying pad template caps 0:00:00.025127279 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2953:gst_pad_query_caps_default:<demux:sink> using caps 0x193ab70 video/mpegts, systemstream=(boolean)true 0:00:00.025140440 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<demux:sink> query returned video/mpegts, systemstream=(boolean)true 0:00:00.025152627 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2023:gst_pad_link_check_compatible_unlocked:<fdsrc0:src> src caps ANY 0:00:00.025162099 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2025:gst_pad_link_check_compatible_unlocked:<demux:sink> sink caps video/mpegts, systemstream=(boolean)true 0:00:00.025172781 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2043:gst_pad_link_check_compatible_unlocked: caps are compatible 0:00:00.025223257 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<aacparse0:src> get pad caps with filter (NULL) 0:00:00.025241226 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2900:gst_pad_query_caps_default:<aacparse0:src> query caps caps query: 0x1a3b8a0, GstQueryCaps, filter=(GstCaps)"NULL", caps=(GstCaps)"NULL"; 0:00:00.025256290 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2917:gst_pad_query_caps_default:<aacparse0:src> fixed pad caps: trying pad caps 0:00:00.025264975 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2923:gst_pad_query_caps_default:<aacparse0:src> trying pad template caps 0:00:00.025273118 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2953:gst_pad_query_caps_default:<aacparse0:src> using caps 0x193ad90 audio/mpeg, framed=(boolean)true, mpegversion=(int){ 2, 4 }, stream-format=(string){ raw, adts, adif, loas } 0:00:00.025298779 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<aacparse0:src> query returned audio/mpeg, framed=(boolean)true, mpegversion=(int){ 2, 4 }, stream-format=(string){ raw, adts, adif, loas } 0:00:00.025317412 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<rtpmp4apay0:sink> get pad caps with filter (NULL) 0:00:00.025330932 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<rtpmp4apay0:sink> query returned audio/mpeg, mpegversion=(int)4, stream-format=(string)raw 0:00:00.025362286 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<aacparse0:src> get pad caps with filter (NULL) 0:00:00.025375300 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2900:gst_pad_query_caps_default:<aacparse0:src> query caps caps query: 0x1a3b940, GstQueryCaps, filter=(GstCaps)"NULL", caps=(GstCaps)"NULL"; 0:00:00.025389718 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2917:gst_pad_query_caps_default:<aacparse0:src> fixed pad caps: trying pad caps 0:00:00.025398297 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2923:gst_pad_query_caps_default:<aacparse0:src> trying pad template caps 0:00:00.025406384 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2953:gst_pad_query_caps_default:<aacparse0:src> using caps 0x193ad90 audio/mpeg, framed=(boolean)true, mpegversion=(int){ 2, 4 }, stream-format=(string){ raw, adts, adif, loas } 0:00:00.025426149 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<aacparse0:src> query returned audio/mpeg, framed=(boolean)true, mpegversion=(int){ 2, 4 }, stream-format=(string){ raw, adts, adif, loas } 0:00:00.025443905 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<rtpmp4apay0:sink> get pad caps with filter (NULL) 0:00:00.025456608 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<rtpmp4apay0:sink> query returned audio/mpeg, mpegversion=(int)4, stream-format=(string)raw 0:00:00.025470522 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2023:gst_pad_link_check_compatible_unlocked:<aacparse0:src> src caps audio/mpeg, framed=(boolean)true, mpegversion=(int){ 2, 4 }, stream-format=(string){ raw, adts, adif, loas } 0:00:00.025486704 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2025:gst_pad_link_check_compatible_unlocked:<rtpmp4apay0:sink> sink caps audio/mpeg, mpegversion=(int)4, stream-format=(string)raw 0:00:00.025502435 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2043:gst_pad_link_check_compatible_unlocked: caps are compatible 0:00:00.025526475 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<rtpmp4apay0:src> get pad caps with filter (NULL) 0:00:00.025539135 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2900:gst_pad_query_caps_default:<rtpmp4apay0:src> query caps caps query: 0x1a3b9e0, GstQueryCaps, filter=(GstCaps)"NULL", caps=(GstCaps)"NULL"; 0:00:00.025554047 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2923:gst_pad_query_caps_default:<rtpmp4apay0:src> trying pad template caps 0:00:00.025562525 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2953:gst_pad_query_caps_default:<rtpmp4apay0:src> using caps 0x193ade0 application/x-rtp, media=(string)audio, payload=(int)[ 96, 127 ], clock-rate=(int)[ 1, 2147483647 ], encoding-name=(string)MP4A-LATM 0:00:00.025582085 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<rtpmp4apay0:src> query returned application/x-rtp, media=(string)audio, payload=(int)[ 96, 127 ], clock-rate=(int)[ 1, 2147483647 ], encoding-name=(string)MP4A-LATM 0:00:00.025598014 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<fakesink0:sink> get pad caps with filter (NULL) 0:00:00.025613916 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<fakesink0:sink> query returned ANY 0:00:00.025630942 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<rtpmp4apay0:src> get pad caps with filter (NULL) 0:00:00.025642635 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2900:gst_pad_query_caps_default:<rtpmp4apay0:src> query caps caps query: 0x1a3ba80, GstQueryCaps, filter=(GstCaps)"NULL", caps=(GstCaps)"NULL"; 0:00:00.025656969 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2923:gst_pad_query_caps_default:<rtpmp4apay0:src> trying pad template caps 0:00:00.025665226 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2953:gst_pad_query_caps_default:<rtpmp4apay0:src> using caps 0x193ade0 application/x-rtp, media=(string)audio, payload=(int)[ 96, 127 ], clock-rate=(int)[ 1, 2147483647 ], encoding-name=(string)MP4A-LATM 0:00:00.025681779 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<rtpmp4apay0:src> query returned application/x-rtp, media=(string)audio, payload=(int)[ 96, 127 ], clock-rate=(int)[ 1, 2147483647 ], encoding-name=(string)MP4A-LATM 0:00:00.025696995 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<fakesink0:sink> get pad caps with filter (NULL) 0:00:00.025709570 26488 0x18e7d20 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<fakesink0:sink> query returned ANY 0:00:00.025719561 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2023:gst_pad_link_check_compatible_unlocked:<rtpmp4apay0:src> src caps application/x-rtp, media=(string)audio, payload=(int)[ 96, 127 ], clock-rate=(int)[ 1, 2147483647 ], encoding-name=(string)MP4A-LATM 0:00:00.025733639 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2025:gst_pad_link_check_compatible_unlocked:<fakesink0:sink> sink caps ANY 0:00:00.025739742 26488 0x18e7d20 DEBUG GST_CAPS gstpad.c:2043:gst_pad_link_check_compatible_unlocked: caps are compatible Setting pipeline to PAUSED ... 0:00:00.026041013 26488 0x18e7d20 DEBUG aacparse gstaacparse.c:1355:gst_aac_parse_start: start 0:00:00.026126318 26488 0x18e7d20 WARN GST_POLL gstpoll.c:829:gst_poll_remove_fd: 0x1a3bc00: couldn't find fd ! Pipeline is PREROLLING ... 0:00:00.026356373 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<fdsrc0:src> get pad caps with filter (NULL) 0:00:00.026378526 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<fdsrc0:src> query returned ANY 0:00:00.026389310 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2468:gst_pad_get_current_caps:<fdsrc0:src> get current pad caps (NULL) 0:00:00.026624899 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<demux:audio_0100> get pad caps with filter (NULL) 0:00:00.026640084 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2900:gst_pad_query_caps_default:<demux:audio_0100> query caps caps query: 0x1a3bf20, GstQueryCaps, filter=(GstCaps)"NULL", caps=(GstCaps)"NULL"; 0:00:00.026654106 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2917:gst_pad_query_caps_default:<demux:audio_0100> fixed pad caps: trying pad caps 0:00:00.026660142 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2953:gst_pad_query_caps_default:<demux:audio_0100> using caps 0x1a3be80 audio/mpeg, mpegversion=(int)2, stream-format=(string)adts 0:00:00.026674043 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<demux:audio_0100> query returned audio/mpeg, mpegversion=(int)2, stream-format=(string)adts 0:00:00.026684842 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<aacparse0:sink> get pad caps with filter (NULL) 0:00:00.026695386 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2807:gst_pad_peer_query_caps:<aacparse0:src> get pad peer caps with filter (NULL) 0:00:00.026706451 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2814:gst_pad_peer_query_caps:<aacparse0:src> peer query returned audio/mpeg, mpegversion=(int)4, stream-format=(string)raw 0:00:00.026729054 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<aacparse0:sink> query returned audio/mpeg, mpegversion=(int)4, stream-format=(string)raw 0:00:00.026742871 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<demux:audio_0100> get pad caps with filter (NULL) 0:00:00.026751266 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2900:gst_pad_query_caps_default:<demux:audio_0100> query caps caps query: 0x7f85cc0020f0, GstQueryCaps, filter=(GstCaps)"NULL", caps=(GstCaps)"NULL"; 0:00:00.026762628 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2917:gst_pad_query_caps_default:<demux:audio_0100> fixed pad caps: trying pad caps 0:00:00.026768346 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2953:gst_pad_query_caps_default:<demux:audio_0100> using caps 0x1a3be80 audio/mpeg, mpegversion=(int)2, stream-format=(string)adts 0:00:00.026779774 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<demux:audio_0100> query returned audio/mpeg, mpegversion=(int)2, stream-format=(string)adts 0:00:00.026806139 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:814:gst_element_get_compatible_pad_template: compatible direction: found sink pad template "sink" 0:00:00.026814104 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:817:gst_element_get_compatible_pad_template: intersecting audio/mpeg, mpegversion=(int)2, stream-format=(string)adts 0:00:00.026823596 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:819:gst_element_get_compatible_pad_template: ..and audio/mpeg, mpegversion=(int){ 2, 4 } 0:00:00.026843487 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:825:gst_element_get_compatible_pad_template: caps are compatible 0:00:00.026864247 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<demux:audio_0100> get pad caps with filter (NULL) 0:00:00.026873578 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2900:gst_pad_query_caps_default:<demux:audio_0100> query caps caps query: 0x7f85cc002140, GstQueryCaps, filter=(GstCaps)"NULL", caps=(GstCaps)"NULL"; 0:00:00.026884894 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2917:gst_pad_query_caps_default:<demux:audio_0100> fixed pad caps: trying pad caps 0:00:00.026890709 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2953:gst_pad_query_caps_default:<demux:audio_0100> using caps 0x1a3be80 audio/mpeg, mpegversion=(int)2, stream-format=(string)adts 0:00:00.026902820 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<demux:audio_0100> query returned audio/mpeg, mpegversion=(int)2, stream-format=(string)adts 0:00:00.026912928 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2761:gst_pad_query_caps:<aacparse0:sink> get pad caps with filter (NULL) 0:00:00.026921683 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2807:gst_pad_peer_query_caps:<aacparse0:src> get pad peer caps with filter (NULL) 0:00:00.026931830 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2814:gst_pad_peer_query_caps:<aacparse0:src> peer query returned audio/mpeg, mpegversion=(int)4, stream-format=(string)raw 0:00:00.026950488 26488 0x1a3bc50 DEBUG GST_CAPS gstutils.c:2768:gst_pad_query_caps:<aacparse0:sink> query returned audio/mpeg, mpegversion=(int)4, stream-format=(string)raw 0:00:00.026960666 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2023:gst_pad_link_check_compatible_unlocked:<demux:audio_0100> src caps audio/mpeg, mpegversion=(int)2, stream-format=(string)adts 0:00:00.026976874 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2025:gst_pad_link_check_compatible_unlocked:<aacparse0:sink> sink caps audio/mpeg, mpegversion=(int)4, stream-format=(string)raw 0:00:00.026987617 26488 0x1a3bc50 DEBUG GST_CAPS gstpad.c:2043:gst_pad_link_check_compatible_unlocked: caps are notcompatible 0:00:00.027058371 26488 0x1a3bc50 WARN basesrc gstbasesrc.c:2910:gst_base_src_loop:<fdsrc0> error: Internal data flow error. 0:00:00.027065477 26488 0x1a3bc50 WARN basesrc gstbasesrc.c:2910:gst_base_src_loop:<fdsrc0> error: streaming task paused, reason not-linked (-1) ERROR: from element /GstPipeline:pipeline0/GstFdSrc:fdsrc0: Internal data flow error. /GstPipeline:pipeline0/GstTSDemux:demux.GstPad:audio_0100: caps = "NULL" Additional debug info: gstbasesrc.c(2910): gst_base_src_loop (): /GstPipeline:pipeline0/GstFdSrc:fdsrc0: streaming task paused, reason not-linked (-1) ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... 0:00:00.028146832 26488 0x18e7d20 DEBUG aacparse gstaacparse.c:1374:gst_aac_parse_stop: stop Freeing pipeline ...
MPEG4 AAC is a superset of MPEG2 AAC, so the conversion should be possible somehow in this direction at least.
(In reply to comment #1) > MPEG4 AAC is a superset of MPEG2 AAC, so the conversion should be possible > somehow in this direction at least. If this is true, then what if we make such a hack: in case of input being "mpegversion=2,stream-format=adts" and mpegversion=4 is requested on output, let aacparse pretend it is "mpegversion=4,stream-format=adts".
Did you try if that works? ;) I'm not sure if it's that simple, some actual conversion might be necessary. Someone with enough time needs to read the standard, that's why it exists.
(Please don't dump so much debug output into a bugzilla comment, use an attachment in future) > let aacparse pretend it is "mpegversion=4,stream-format=adts". I believe at the very least you would need to fix up the adts headers then still.
*** Bug 766065 has been marked as a duplicate of this bug. ***
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/106.