[FFmpeg-trac] #6673(avformat:reopened): fmp4/hls not working with remote paths

FFmpeg trac at avcodec.org
Wed Sep 20 06:05:45 EEST 2017


#6673: fmp4/hls not working with remote paths
-------------------------------------+-------------------------------------
             Reporter:               |                    Owner:
  thecodeassassin                    |                   Status:  reopened
                 Type:  defect       |                Component:  avformat
             Priority:  normal       |               Resolution:
              Version:  git-master   |               Blocked By:
             Keywords:  fmp4 hls     |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------

Comment (by stevenliu):

 Replying to [comment:6 thecodeassassin]:
 > Yeah this patch solves the problem. However my playlist doesn't seem to
 play in a test player:
 >
 > #EXTM3U
 > #EXT-X-VERSION:7
 > #EXT-X-MEDIA-SEQUENCE:0
 > #EXT-X-ALLOW-CACHE:YES
 > #EXT-X-PLAYLIST-TYPE:VOD
 > #EXT-X-TARGETDURATION:4
 > #EXT-X-INDEPENDENT-SEGMENTS
 > #EXT-X-MAP:URI="init_720p.mp4"
 >
 > #EXTINF:4.000000,
 > 720p_segment_1505824953.m4s
 > #EXTINF:4.000000,
 > 720p_segment_1505824958.m4s
 > #EXTINF:2.200000,
 > 720p_segment_1505824962.m4s
 > #EXT-X-ENDLIST
 >
 > Playlist: https://d3ksou5z0j9mc7.cloudfront.net/stephen-
 test-7/master.m3u8
 >
 > {{{
 > ffmpeg -i  https://d3ksou5z0j9mc7.cloudfront.net/stephen-
 test-7/master.m3u8 -acodec aac -b:a 128k -vcodec libx264 -b:v 3000k
 -preset ultrafast -movflags +faststart -f mp4 pipe:1 > ~/test.mp4
 > ffmpeg version N-87327-g18821e3 Copyright (c) 2000-2017 the FFmpeg
 developers
 >   built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
 >   configuration: --prefix=/usr/local --enable-gpl --enable-nonfree
 --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libx264
 >   libavutil      55. 75.100 / 55. 75.100
 >   libavcodec     57.106.101 / 57.106.101
 >   libavformat    57. 82.100 / 57. 82.100
 >   libavdevice    57.  8.101 / 57.  8.101
 >   libavfilter     6.105.100 /  6.105.100
 >   libswscale      4.  7.103 /  4.  7.103
 >   libswresample   2.  8.100 /  2.  8.100
 >   libpostproc    54.  6.100 / 54.  6.100
 > [hls,applehttp @ 0x7fa63c800000] Opening
 'https://d3ksou5z0j9mc7.cloudfront.net/stephen-test-7/720p/playlist.m3u8'
 for reading
 > [hls,applehttp @ 0x7fa63c800000] Opening
 'https://d3ksou5z0j9mc7.cloudfront.net/stephen-test-7/480p/playlist.m3u8'
 for reading
 > [hls,applehttp @ 0x7fa63c800000] Opening
 'https://d3ksou5z0j9mc7.cloudfront.net/stephen-test-7/240p/playlist.m3u8'
 for reading
 > [hls,applehttp @ 0x7fa63c800000] Opening
 'https://d3ksou5z0j9mc7.cloudfront.net/stephen-test-7/720p/init_720p.mp4'
 for reading
 > Could not read complete segment.
 > [hls,applehttp @ 0x7fa63c800000] Opening
 'https://d3ksou5z0j9mc7.cloudfront.net/stephen-
 test-7/720p/720p_segment_1505824953.m4s' for reading
 > [hls,applehttp @ 0x7fa63c800000] Opening
 'https://d3ksou5z0j9mc7.cloudfront.net/stephen-test-7/480p/init_480p.mp4'
 for reading
 > Could not read complete segment.
 > [hls,applehttp @ 0x7fa63c800000] Opening
 'https://d3ksou5z0j9mc7.cloudfront.net/stephen-
 test-7/480p/480p_segment_1505824953.m4s' for reading
 > [hls,applehttp @ 0x7fa63c800000] Opening
 'https://d3ksou5z0j9mc7.cloudfront.net/stephen-test-7/240p/init_240p.mp4'
 for reading
 > Could not read complete segment.
 > [hls,applehttp @ 0x7fa63c800000] Opening
 'https://d3ksou5z0j9mc7.cloudfront.net/stephen-
 test-7/240p/240p_segment_1505824953.m4s' for reading
 > [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa63b817e00] stream 0, offset 0xc76:
 partial file
 > [hls,applehttp @ 0x7fa63c800000] Could not find codec parameters for
 stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720, 2239 kb/s):
 unspecified pixel format
 > Consider increasing the value for the 'analyzeduration' and 'probesize'
 options
 > [hls,applehttp @ 0x7fa63c800000] Could not find codec parameters for
 stream 2 (Video: h264 (avc1 / 0x31637661), none, 854x480, 1110 kb/s):
 unspecified pixel format
 > Consider increasing the value for the 'analyzeduration' and 'probesize'
 options
 > [hls,applehttp @ 0x7fa63c800000] Could not find codec parameters for
 stream 4 (Video: h264 (avc1 / 0x31637661), none, 426x240, 379 kb/s):
 unspecified pixel format
 > Consider increasing the value for the 'analyzeduration' and 'probesize'
 options
 > Input #0, hls,applehttp, from 'https://d3ksou5z0j9mc7.cloudfront.net
 /stephen-test-7/master.m3u8':
 >   Duration: 00:05:18.87, bitrate: 0 kb/s
 >   Program 0
 >     Metadata:
 >       variant_bitrate : 3000000
 >     Stream #0:0: Video: h264 (avc1 / 0x31637661), none, 1280x720, 2239
 kb/s, 15360 tbr, 15360 tbn, 30720 tbc
 >     Metadata:
 >       variant_bitrate : 3000000
 >     Stream #0:1: Audio: aac (mp4a / 0x6134706D), 44100 Hz, 5.1, fltp,
 127 kb/s
 >     Metadata:
 >       variant_bitrate : 3000000
 >   Program 1
 >     Metadata:
 >       variant_bitrate : 1500000
 >     Stream #0:2: Video: h264 (avc1 / 0x31637661), none, 854x480, 1110
 kb/s, 15360 tbr, 15360 tbn, 30720 tbc
 >     Metadata:
 >       variant_bitrate : 1500000
 >     Stream #0:3: Audio: aac (mp4a / 0x6134706D), 44100 Hz, 5.1, fltp,
 127 kb/s
 >     Metadata:
 >       variant_bitrate : 1500000
 >   Program 2
 >     Metadata:
 >       variant_bitrate : 800000
 >     Stream #0:4: Video: h264 (avc1 / 0x31637661), none, 426x240, 379
 kb/s, 15360 tbr, 15360 tbn, 30720 tbc
 >     Metadata:
 >       variant_bitrate : 800000
 >     Stream #0:5: Audio: aac (mp4a / 0x6134706D), 44100 Hz, 5.1, fltp,
 127 kb/s
 >     Metadata:
 >       variant_bitrate : 800000
 > Stream mapping:
 >   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
 >   Stream #0:1 -> #0:1 (aac (native) -> aac (native))
 > Press [q] to stop, [?] for help
 > [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa63b817e00] stream 0, offset 0xc76:
 partial file
 > https://d3ksou5z0j9mc7.cloudfront.net/stephen-test-7/master.m3u8:
 Invalid data found when processing input
 > Finishing stream 0:0 without any data written to it.
 > Finishing stream 0:1 without any data written to it.
 > Nothing was written into output file 0 (pipe:1), because at least one of
 its streams received no packets.
 > frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=-577014:32:22.77
 bitrate=  -0.0kbits/s speed=N/A
 > video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: unknown
 > [aac @ 0x7fa63c01ee00] Qavg: na
 > }}}
 >
 > However, the same structure with ts segments work fine.
 >
 > Replying to [comment:5 stevenliu]:
 > > Replying to [comment:3 thecodeassassin]:
 > > > hi stevenliu, thanks for the quick reponse. It seems that it does
 not upload the init.mp4 to the remote endpoint. As in i'm not getting PUT
 request here for that file.
 > >
 > > https://patchwork.ffmpeg.org/patch/5191/
 > >
 > > Try this patch please.
 > >
 > >
 > >
 > > {{{
 > > liuqideMBP:hlsdemux liuqi$ ls -hl /usr/local/nginx/html/
 > > total 48
 > > -rwxrwxrwx  1 root    admin   537B  5 17  2016 50x.html
 > > -rw-r--r--  1 liuqi   admin   1.0K  1 28  2017 a.html
 > > -rw-r--r--  1 liuqi   admin   1.1K  7  1 08:17 aaa.mpd
 > > -rw-r--r--  1 liuqi   admin   1.1K  6 30 23:20 aaa_bbb.mpd
 > > drwxrwxrwx  2 root    admin    68B 10 12  2016 flowstream
 > > -rwxrwxrwx  1 root    admin   612B  5 17  2016 index.html
 > > drwxrwxrwx  7 liuqi   admin   238B  7 18 19:59 test
 > > -rwxrwxrwx  1 nobody  admin   239B  5 18  2016 upload.hls
 > > liuqideMBP:hlsdemux liuqi$ ./ffmpeg -i ~/Movies/objectC/facebook.mp4
 -loglevel warning      -hls_fmp4_init_filename
 http://192.168.0.157/init.mp4 -c:a aac -b:a 128k -ar 44100 -c:v libx264
 -max_muxing_queue_size 400 -x264opts no-scenecut -force_key_frames
 "expr:gte(t,n_forced*2)" -crf 23 -start_number 0 -hls_time 4
 -hls_list_size 3 -use_localtime 1 -hls_segment_type fmp4
 -hls_segment_filename "http://192.168.0.157/segment_%s.m4s" -preset
 ultrafast -profile:v main -level 3.1 -r 30 -threads 0 -vf "scale=-2:720"
 -bufsize 2000k -maxrate 2000k -b:v 2000k -f hls -method PUT -t 20
 "http://192.168.0.157/playlist.m3u8"
 > > [libx264 @ 0x7f9198030e00] frame MB size (81x45) > level limit (3600)
 > > [libx264 @ 0x7f9198030e00] MB rate (109350) > level limit (108000)
 > > [hls @ 0x7f91980a4c00] Cannot use rename on non file protocol, this
 may lead to races and temporary partial files
 > > [mp4 @ 0x7f9198000600] Track 0 starts with a nonzero dts 357, while
 the moov already has been written. Set the delay_moov flag to handle this
 case.
 > > [hls muxer @ 0x7f91980a5200] Duplicated segment filename detected:
 segment_1505815744.m4s
 > > [hls muxer @ 0x7f91980a5200] Duplicated segment filename detected:
 segment_1505815745.m4s
 > > liuqideMBP:hlsdemux liuqi$ ls -hl /usr/local/nginx/html/
 > > total 8800
 > > -rwxrwxrwx  1 root    admin   537B  5 17  2016 50x.html
 > > -rw-r--r--  1 liuqi   admin   1.0K  1 28  2017 a.html
 > > -rw-r--r--  1 liuqi   admin   1.1K  7  1 08:17 aaa.mpd
 > > -rw-r--r--  1 liuqi   admin   1.1K  6 30 23:20 aaa_bbb.mpd
 > > drwxrwxrwx  2 root    admin    68B 10 12  2016 flowstream
 > > -rwxrwxrwx  1 root    admin   612B  5 17  2016 index.html
 > > -rw-rw-rw-  1 nobody  admin   1.2K  9 19 18:09 init.mp4
 > > -rw-rw-rw-  1 nobody  admin   217B  9 19 18:09 playlist.m3u8
 > > -rw-rw-rw-  1 nobody  admin   1.2M  9 19 18:09 segment_1505815744.m4s
 > > -rw-rw-rw-  1 nobody  admin   1.0M  9 19 18:09 segment_1505815745.m4s
 > > -rw-rw-rw-  1 nobody  admin   1.0M  9 19 18:09 segment_1505815746.m4s
 > > -rw-rw-rw-  1 nobody  admin   1.0M  9 19 18:09 segment_1505815747.m4s
 > > drwxrwxrwx  7 liuqi   admin   238B  7 18 19:59 test
 > > -rwxrwxrwx  1 nobody  admin   239B  5 18  2016 upload.hls
 > > }}}


 base on the previous patch , and use this patch :
 https://patchwork.ffmpeg.org/patch/5200/
 to play the hls like this:

 ffplay cache:http://xxxxxx/xxxx.m3u8


 for example:
 ./ffplay cache:http://192.168.0.157/playlist.m3u8

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6673#comment:8>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list