[FFmpeg-devel] Fwd: [PATCH] Automatically inserted bitstream filter 'h264_mp4toannexb' into hlsenc

Steven Liu lingjiujianke at gmail.com
Wed Jul 13 19:04:15 EEST 2016


2016-07-13 19:35 GMT+08:00 Michael Niedermayer <michael at niedermayer.cc>:

> On Wed, Jul 13, 2016 at 07:22:52PM +0800, Steven Liu wrote:
> > 2016-07-13 18:28 GMT+08:00 Michael Niedermayer <michael at niedermayer.cc>:
> >
> > > On Wed, Jun 29, 2016 at 01:07:13AM +0200, Hendrik Leppkes wrote:
> > > > On Wed, Jun 29, 2016 at 12:30 AM, Steven Liu <
> lingjiujianke at gmail.com>
> > > wrote:
> > > > >
> > > > >
> > > > > 2016-06-29 0:16 GMT+08:00 Hendrik Leppkes <h.leppkes at gmail.com>:
> > > > >>
> > > > >> On Tue, Jun 28, 2016 at 3:29 PM, Steven Liu <
> lingjiujianke at gmail.com>
> > > > >> wrote:
> > > > >> > before patched:
> > > > >> > [root at localhost ffmpeg]# ./ffmpeg_g -re -i /root/facebook.mp4
> -c
> > > copy -f
> > > > >> > hls -v verbose -y aaaa.m3u8
> > > > >> > ffmpeg version N-80779-gb18d6c5 Copyright (c) 2000-2016 the
> FFmpeg
> > > > >> > developers
> > > > >>
> > > > >>
> > > > >> The way I see it, the auto bsf from the mpegts muxer should
> already
> > > > >> cover this without changes?
> > > > >
> > > > >
> > > > > add the hls_check_bitstream into hls format and call the hls->avf
> to
> > > call
> > > > > the mpegtsenc's check_bitstream,
> > > > > don't do this operation,  it won't call the mpegtsenc's
> > > check_bitstream,
> > > > > look at the message bellow:
> > > > >
> > > >
> > > > This is the wrong approach to fixing this however, it should be
> > > > understood first why its not doing this transparently right now.
> > > > hlsenc uses the mpegts muxer like one would use any other muxer, so
> > > > why does autobsf not get used?
> > > >
> > > > If we understand that, maybe it can be fixed in a more generic way,
> > > > and not end up in ugly hacks in hlsenc.
> > >
> > > The issue is that hlsenc does call ff_write_chained() which causes
> > > av_write_frame() instead of av_interleaved_write_frame() to be used,
> > > bypassing the current auto bsf code
> > >
> > > Using av_interleaved_write_frame() would, i assume introduce a delay
> > >
> > > The patch doesnt work either, for example this:
> > > ./ffmpeg -i matrixbench_mpeg2.mpg -i
> > > fate-suite/sub/MovText_capability_tester.mp4  -f hls     file.m3u8
> > >
> > > segfaults
> > >
> > >
> > Hi Michael,
> >
> >        Can you upload the matrixbench_mpeg2.mpg and
> > fate-suite/sub/MovText_capability_tester.mp4? Let me test and fix it!
> >
>
> http://samples.ffmpeg.org/benchmark/testsuite1/matrixbench_mpeg2.mpg
> http://fate-suite.ffmpeg.org/sub/MovText_capability_tester.mp4
>
>

Hi Michael,

      I have fixed the segfaults, the segfaults is webvtt subtitle stream
check_bitstream by the mpegts, so check the conditions before the
oc->oformat->check_bitstream(), then fixed it.

      but i have a question, when i using the ./tools/patcheck, the
patcheck give me the message:

These functions may need av_cold, please review the whole patch for similar
functions needing av_cold

0001-Automatically-inserted-bitstream-filter-h264_mp4toan.patch:30:+static
int hls_write_header_init(AVFormatContext *s)

How can i fix it in patch?


after the patch:

localhost:test_movie StevenLiu$ ../ffmpeg/ffmpeg -i ./matrixbench_mpeg2.mpg
-i ./MovText_capability_tester.mp4 -f hls file.m3u8

ffmpeg version N-80961-g4f0e388 Copyright (c) 2000-2016 the FFmpeg
developers

  built with Apple LLVM version 7.3.0 (clang-703.0.31)

  configuration: --enable-libass --enable-opengl --enable-libx264
--enable-libmp3lame --enable-gpl --enable-libfaac --enable-nonfree
--prefix=/usr/local --enable-libopencv --enable-libtesseract
--enable-libspeex

  libavutil      55. 28.100 / 55. 28.100

  libavcodec     57. 50.100 / 57. 50.100

  libavformat    57. 41.100 / 57. 41.100

  libavdevice    57.  0.102 / 57.  0.102

  libavfilter     6. 47.100 /  6. 47.100

  libswscale      4.  1.100 /  4.  1.100

  libswresample   2.  1.100 /  2.  1.100

  libpostproc    54.  0.100 / 54.  0.100

[mpeg @ 0x7f94a200aa00] start time for stream 0 is not set in
estimate_timings_from_pts

Input #0, mpeg, from './matrixbench_mpeg2.mpg':

  Duration: 00:03:07.66, start: 0.220000, bitrate: 5633 kb/s

    Stream #0:0[0x1bf]: Data: dvd_nav_packet

    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv,
bt470bg/bt470m/bt470m), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k
tbn, 50 tbc

    Stream #0:2[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16p, 384 kb/s

Input #1, mov,mp4,m4a,3gp,3g2,mj2, from './MovText_capability_tester.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 1

    compatible_brands: isom

    creation_time   : 2012-07-04 05:10:41

  Duration: 00:00:08.14, bitrate: 0 kb/s

    Stream #1:0(und): Subtitle: mov_text (tx3g / 0x67337874), 400x60, 0
kb/s (default)

    Metadata:

      creation_time   : 2012-07-04 05:10:41

      handler_name    : reference.srt - Imported with GPAC 0.4.6-DEV-rev4019

[libx264 @ 0x7f94a3804800] using SAR=16/15

[libx264 @ 0x7f94a3804800] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX AVX2 FMA3 LZCNT BMI2

[libx264 @ 0x7f94a3804800] profile High, level 3.0

[hls @ 0x7f94a2242600] Using AVStream.codec to pass codec parameters to
muxers is deprecated, use AVStream.codecpar instead.

    Last message repeated 2 times

Output #0, hls, to 'file.m3u8':

  Metadata:

    encoder         : Lavf57.41.100

    Stream #0:0: Video: h264 (libx264), yuv420p, 720x576 [SAR 16:15 DAR
4:3], q=-1--1, 25 fps, 90k tbn, 25 tbc

    Metadata:

      encoder         : Lavc57.50.100 libx264

    Side data:

      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1

    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s

    Metadata:

      encoder         : Lavc57.50.100 aac

    Stream #0:2(und): Subtitle: webvtt, 400x60 (default)

    Metadata:

      creation_time   : 2012-07-04 05:10:41

      handler_name    : reference.srt - Imported with GPAC 0.4.6-DEV-rev4019

      encoder         : Lavc57.50.100 webvtt

Stream mapping:

  Stream #0:1 -> #0:0 (mpeg2video (native) -> h264 (libx264))

  Stream #0:2 -> #0:1 (mp2 (native) -> aac (native))

  Stream #1:0 -> #0:2 (mov_text (native) -> webvtt (native))

Press [q] to stop, [?] for help

frame=  298 fps= 24 q=28.0 size=N/A time=00:00:11.75 bitrate=N/A
speed=0.937x
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Automatically-inserted-bitstream-filter-h264_mp4toan.patch
Type: application/octet-stream
Size: 2479 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160714/aabdebe1/attachment.obj>


More information about the ffmpeg-devel mailing list