[FFmpeg-devel] [PATCH]flvenc Allow ffmpeg -copy on rtmp outputs from udp inputs

Michael Niedermayer michaelni at gmx.at
Mon Jun 9 04:12:54 CEST 2014

On Mon, Jun 09, 2014 at 01:27:28AM +0200, Tudor SUCIU wrote:
> you said similar code is in the mp4 muxer and i see similar code in
> > matroskadec line 1820
> >
> > I think the code from matroskadec is not reusable, there are no strings to
> parse that I know of (at flvenc level).
> > I think factorizing all these instances from libavformat into a
> > single case if possible should happen.
> > I suggest this also because the code in matroskadec considers
> > profile and SBR, which your code ignores
> >
> > I don't have access immediately to Flash Media Encoder 3, but if I
> remember correctly it sends only 2 bytes of extradata for he-aacv2. As fmle
> 3.0 is the reference software for flv, i'll modify the patch if it sends
> more than 2 bytes of extradata.
> The problem at flvenc level is that in the case of ffmpeg -copy the audio
> profile is "-99" so I couldn't extract it. This is why the code is for the
> time being working only with AAC-LC.
> I totally agree that this code is present in a little too many places. I'm
> not sure that I would be able to make the required changes by myself. With
> ffmpeg i'm used to make the smallest changes that allow me to maintain
> patches over long periods of time. I would gladly update this patch when
> somebody fixes the implementation of one other muxer/decoder and adds the
> relevant code in a common place.
> > also muxers should not write to the extradata field of AVCodecContext
> > a local variable seems more correct
> >
> There is no problem, i can do that.
> > and then please see libavcodec/aac_adtstoasc_bsf.c and check if
> > using it would fix the issue you are trying to fixe
> >
> This filter is required, if i don't specify it i get:
> [flv @ 0x2ab0700] Malformed AAC bitstream detected: use audio bitstream
> filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)
> av_interleaved_write_frame(): Invalid data found when processing input
> I remember that a few years ago when i worked on an hds segmenter ffmpeg
> didn't complain and the adts headers were being sent into the flv. It did
> break part of the players, it's a good thing it's corrected now.
> The bug is clearly the fact that the audio bitstream filter is called after
> the creation of flv header. I have absolutely no idea how to fix it.
> > and please provide a sample and commandline (testcase)
> >
> I wanted to play with cc608 subtitles, so I got the hls files from
> http://www.cpcweb.com/webcasts/webcast_samples.htm.
> I concatenated .ts files from the .m3u8, then (any .ts file will do):
> ./ffmpeg -i ~/Downloads/testhls/test.ts -acodec copy -vcodec copy -bsf:a
> aac_adtstoasc -bsf:v remove_extra -f flv test.flv
> The video bitstream filter fixes all the visible problems from the rtmp
> stream, there are only some AUD h264 nals that remain, it would be nice if
> we could delete them too.

please provide a direct link to the file or upload it
and provide a command line that allows to reproduce the issue with
this file.
Iam happy to help fix this, iam not happy to search and reconstruct
the input file

also i tried 4 random ts files none allowed to reproduce this


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140609/3e1a4e4a/attachment.asc>

More information about the ffmpeg-devel mailing list