mp4 opus invalid extradata size (missing header)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

mp4 opus invalid extradata size (missing header)

Juan Navarro
Hi,

I'm trying to record a plain RTP stream, both with GStreamer and with
FFmpeg, with either H.264 or VP8 video codecs, and OPUS audio in all cases.

I got this working for VP8+OPUS (WEBM) with GStreamer and FFmpeg, and
H.264+OPUS (MP4) with GStreamer, but _not_ FFmpeg. After some testing I
was able to isolate the issue to recording OPUS audio with FFmpeg into
MP4 container (a somewhat uncommon combination I know, but afaik MP4
should be technically able to store OPUS, and it works great with
GStreamer so it is definitely possible).

FFmpeg is missing some extradata, and after the recording is done (after
pressing 'q'), no moov or any other kind of header is written to the MP4
file. However, I guess there is actual OPUS audio in the file, as the
file takes several 100s KB.

FFmpeg version is today's Git master. Report logs, and input SDP files,
are attached to this email (with full command line and output, as per
the '-report' option).

For example, trying to load the file with VLC 3.0.7 shows up this:

    VLC media player 3.0.7 Vetinari (revision 3.0.7-0-g86cee31)
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f12acc16500] invalid size 0 in stsd
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f12acc16500] error reading header
    TagLib: MP4: Invalid atom size
    Qt: Session management error: None of the authentication protocols
    specified are supported
    QApplication: invalid style override passed, ignoring it.
    [00007f12800049e0] mp4 demux error: MP4 plugin discarded (no
    moov,foov,moof box)
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f1280000c80] invalid size 0 in stsd
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f1280000c80] error reading header
    [00007f12800049e0] avcodec demux error: Could not open output.mp4:
    Unknown error 1094995529
    TagLib: MP4: Invalid atom size


For reference, these commands are used for my tests:

WORKS

    ffmpeg \
         -protocol_whitelist file,rtp,udp \
         -fflags +genpts \
         -i recording/input-vp8.sdp \
         -map 0:a:0 -c:a copy \
         -f webm -flags +global_header \
         -y recording/output-ffmpeg-opus.webm


WORKS

    gst-launch-1.0 --eos-on-shutdown \
         filesrc location=recording/input-h264.sdp \
             ! sdpdemux timeout=0 name=demux \
         mp4mux name=mux ! queue \
             ! filesink location=recording/output-gstreamer-opus.mp4 \
         demux. ! queue \
             ! rtpopusdepay \
             ! opusparse \
             ! mux.


FAILS ("no moov" errors during playback)

    ffmpeg \
         -protocol_whitelist file,rtp,udp \
         -fflags +genpts \
         -i recording/input-h264.sdp \
         -map 0:a:0 -c:a copy \
         -f mp4 -strict experimental \
         -y recording/output-ffmpeg-opus.mp4

Relevant output (full log in attached files):

    Press [q] to stop, [?] for help
    # Press 'q' after some time recording...
    [mp4 @ 0x75d2580] invalid extradata size=   0.0kbits/s speed= 1.4x
    Error writing trailer of recording/output-ffmpeg-opus.mp4: Invalid
    data found when processing input


The RTP transport is provided by a media server (mediasoup), but the
actual encoded media comes straight from a Chrome WebRTC connection
(mediasoup just receives it and relays as plain RTP).

Do I need to add some '-flags', '-bsf', or '-movflags' to make this work?

Juan

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

ffmpeg-opus-mp4.log (12K) Download Attachment
ffmpeg-opus-webm.log (115K) Download Attachment
input-h264.sdp (414 bytes) Download Attachment
input-vp8.sdp (294 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: mp4 opus invalid extradata size (missing header)

Juan Navarro
Hi, could anyone shed a bit of light here?
I'm pretty sure it should be possible to receive an H.264 RTP stream and
store as-is into an MP4 file, given that gst-launch is being able to do it.

Maybe I need something akin to the "h264parse" element that's used in
the GStreamer pipeline? Does FFmpeg apply such parser automatically as
part of its internal processing?

Thanks,
Juan
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: mp4 opus invalid extradata size (missing header)

Juan Navarro

On 3/9/19 18:38, Juan Navarro wrote:

> Hi,
>
> I'm trying to record a plain RTP stream, both with GStreamer and with
> FFmpeg, with either H.264 or VP8 video codecs, and OPUS audio in all
> cases.
>
> I got this working for VP8+OPUS (WEBM) with GStreamer and FFmpeg, and
> H.264+OPUS (MP4) with GStreamer, but _not_ FFmpeg. After some testing I
> was able to isolate the issue to recording OPUS audio with FFmpeg into
> MP4 container (a somewhat uncommon combination I know, but afaik MP4
> should be technically able to store OPUS, and it works great with
> GStreamer so it is definitely possible).
>
> FFmpeg is missing some extradata, and after the recording is done (after
> pressing 'q'), no moov or any other kind of header is written to the MP4
> file. However, I guess there is actual OPUS audio in the file, as the
> file takes several 100s KB.
>
> FFmpeg version is today's Git master. Report logs, and input SDP files,
> are attached to this email (with full command line and output, as per
> the '-report' option).
>
> For example, trying to load the file with VLC 3.0.7 shows up this:
>
>    VLC media player 3.0.7 Vetinari (revision 3.0.7-0-g86cee31)
>    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f12acc16500] invalid size 0 in stsd
>    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f12acc16500] error reading header
>    TagLib: MP4: Invalid atom size
>    Qt: Session management error: None of the authentication protocols
>    specified are supported
>    QApplication: invalid style override passed, ignoring it.
>    [00007f12800049e0] mp4 demux error: MP4 plugin discarded (no
>    moov,foov,moof box)
>    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f1280000c80] invalid size 0 in stsd
>    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f1280000c80] error reading header
>    [00007f12800049e0] avcodec demux error: Could not open output.mp4:
>    Unknown error 1094995529
>    TagLib: MP4: Invalid atom size
>
>
> For reference, these commands are used for my tests:
>
> WORKS
>
>    ffmpeg \
>         -protocol_whitelist file,rtp,udp \
>         -fflags +genpts \
>         -i recording/input-vp8.sdp \
>         -map 0:a:0 -c:a copy \
>         -f webm -flags +global_header \
>         -y recording/output-ffmpeg-opus.webm
>
>
> WORKS
>
>    gst-launch-1.0 --eos-on-shutdown \
>         filesrc location=recording/input-h264.sdp \
>             ! sdpdemux timeout=0 name=demux \
>         mp4mux name=mux ! queue \
>             ! filesink location=recording/output-gstreamer-opus.mp4 \
>         demux. ! queue \
>             ! rtpopusdepay \
>             ! opusparse \
>             ! mux.
>
>
> FAILS ("no moov" errors during playback)
>
>    ffmpeg \
>         -protocol_whitelist file,rtp,udp \
>         -fflags +genpts \
>         -i recording/input-h264.sdp \
>         -map 0:a:0 -c:a copy \
>         -f mp4 -strict experimental \
>         -y recording/output-ffmpeg-opus.mp4
>
> Relevant output (full log in attached files):
>
>    Press [q] to stop, [?] for help
>    # Press 'q' after some time recording...
>    [mp4 @ 0x75d2580] invalid extradata size=   0.0kbits/s speed= 1.4x
>    Error writing trailer of recording/output-ffmpeg-opus.mp4: Invalid
>    data found when processing input
>
>
> The RTP transport is provided by a media server (mediasoup), but the
> actual encoded media comes straight from a Chrome WebRTC connection
> (mediasoup just receives it and relays as plain RTP).
>
> Do I need to add some '-flags', '-bsf', or '-movflags' to make this work?
>
> Juan


On 19/9/19 11:45, Juan Navarro wrote:

> Hi, could anyone shed a bit of light here?
> I'm pretty sure it should be possible to receive an H.264 RTP stream and
> store as-is into an MP4 file, given that gst-launch is being able to
> do it.
>
> Maybe I need something akin to the "h264parse" element that's used in
> the GStreamer pipeline? Does FFmpeg apply such parser automatically as
> part of its internal processing?
>
> Thanks,
> Juan
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".


Sorry I thought the email would get inserted a link to read the topic on
the web, but it's not the case and it's been a while since the first email.
So for reference I'm including the original text.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: mp4 opus invalid extradata size (missing header)

Carl Eugen Hoyos-2
In reply to this post by Juan Navarro
Am Di., 3. Sept. 2019 um 18:39 Uhr schrieb Juan Navarro <[hidden email]>:

> I'm trying to record a plain RTP stream, both with GStreamer and with
> FFmpeg, with either H.264 or VP8 video codecs, and OPUS audio in all cases.
>
> I got this working for VP8+OPUS (WEBM) with GStreamer and FFmpeg, and
> H.264+OPUS (MP4) with GStreamer, but _not_ FFmpeg. After some testing I
> was able to isolate the issue to recording OPUS audio with FFmpeg into
> MP4 container (a somewhat uncommon combination I know, but afaik MP4
> should be technically able to store OPUS, and it works great with
> GStreamer so it is definitely possible).
>
> FFmpeg is missing some extradata, and after the recording is done (after
> pressing 'q'), no moov or any other kind of header is written to the MP4
> file. However, I guess there is actual OPUS audio in the file, as the
> file takes several 100s KB.
>
> FFmpeg version is today's Git master. Report logs, and input SDP files,
> are attached to this email (with full command line and output, as per
> the '-report' option).

Feel free to test this patch and report back here:
https://ffmpeg.org/pipermail/ffmpeg-devel/2019-September/250177.html

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".