[FFmpeg-devel] [PATCH v2] avformat/hlsenc: merge mpegts and fmp4 workflow to one workflow

Ian Klassen ian at virtualfunc.com
Fri Aug 2 17:46:06 EEST 2019


On Fri, Aug 2, 2019 at 5:46 AM Michael Niedermayer <michael at niedermayer.cc>
wrote:

> On Wed, Jul 31, 2019 at 04:07:22PM +0800, Steven Liu wrote:
> > write mpegts or fmp4 context into buffer, and flush the buffer into
> > output file when split fragment. merge two format split workflow into
> > one workflow
> >
> > Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> > ---
> >  libavformat/hlsenc.c | 200 ++++++++++++++++++++-----------------------
> >  1 file changed, 92 insertions(+), 108 deletions(-)
>
> make -j5 ffmpeg && ./ffmpeg -f lavfi -re -i testsrc -c:v h264 -hls_flags
> delete_segments -hls_key_info_file file.keyinfo -t 2 /tmp/file-hlsencry.m3u8
> ...
> Output #0, hls, to '/tmp/file-hlsencry.m3u8':
>   Metadata:
>     encoder         : Lavf58.30.100
>     Stream #0:0: Video: h264 (libx264), yuv444p, 320x240 [SAR 1:1 DAR
> 4:3], q=-1--1, 25 fps, 90k tbn, 25 tbc
>     Metadata:
>       encoder         : Lavc58.56.100 libx264
>     Side data:
>       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
> [hls @ 0x24a1800] Opening '/tmp/file-hlsencry0.ts' for writingA speed=
>  0x
> *** Error in `./ffmpeg': free(): invalid size: 0x0000000002b4aa50 ***
> Aborted (core dumped)
>
>
> [hls @ 0x25662840] Opening '/tmp/file-hlsencry0.ts' for writing speed=
>  0x
> ==13307== Invalid read of size 8
> ==13307==    at 0x6BD2FE: avio_close_dyn_buf (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x6F5742: hls_write_trailer (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x763E0A: av_write_trailer (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x4D390A: transcode (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x4B1E1C: main (in ffmpeg/ffmpeg_g)
> ==13307==  Address 0x3dcc6f50 is 8 bytes after a block of size 8 alloc'd
> ==13307==    at 0x4C2A6C5: memalign (vg_replace_malloc.c:727)
> ==13307==    by 0x4C2A760: posix_memalign (vg_replace_malloc.c:876)
> ==13307==    by 0x116963F: av_mallocz (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x6BBA37: ffio_open_whitelist (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x78B1E9: io_open_default (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x6F353D: hls_start (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x6F7312: hls_init (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x761D12: avformat_init_output (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x762434: avformat_write_header (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x4C9D58: check_init_output_file (in ffmpeg/ffmpeg_g)
> ==13307==    by 0x4CB23D: init_output_stream.constprop.23 (in
> ffmpeg/ffmpeg_g)
> ==13307==    by 0x4D079F: reap_filters (in ffmpeg/ffmpeg_g)
> ==13307==
> [hls @ 0x25662840] Opening '/tmp/file-hlsencry.m3u8.tmp' for writing
>
> if you cannot reproduce, tell me and ill rebuild and provide better
> debug info
>
> Thanks
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Its not that you shouldnt use gotos but rather that you should write
> readable code and code with gotos often but not always is less readable
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


Is this patch to address bug #7975? https://trac.ffmpeg.org/ticket/7975

I tested it on Windows and it still crashes when attempting to write to a
http server that doesn't support persistent connections:

[http @ 0000029C0EBAD080] URL read error: End of file
[http @ 0000029C0D410740] Opening 'http://127.0.0.1/stream2.ts' for writing
[http @ 0000029C0EBAD080] URL read error: Error number -10053 occurred
[http @ 0000029C0D410740] Opening 'http://127.0.0.1/stream.m3u8' for writing
av_interleaved_write_frame(): Unknown error


More information about the ffmpeg-devel mailing list