Opened 5 years ago

Last modified 5 years ago

#7646 new defect

Loading Remote ffmpeg FMP4 HLS Streams Return Faulty Codec with Missing Pixel Format

Reported by: Offek Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: hls
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
An HLS stream of the fmp4 segment format created with ffmpeg is not playable (using ffplay), and is not able to be copied/streamed using another ffmpeg instance from remote machines because it returns faulty codec parameters with missing pixel format "none(left)" instead of yuv420p.
How to reproduce:

In one machine, in the correct html directory, create the fmp4 hls stream

sudo ffmpeg -y -analyzeduration 6M -probesize 6M -i "udp://..." -map 0 -profile:v main -bf 0 -preset faster -ar 48000 -crf 20 -b:a 96k -c:v h264 -c:a aac -movflags faststart -f hls -hls_segment_type fmp4 -hls_time 5 -hls_list_size 12 -hls_flags delete_segments -hls_segment_filename high_%d.m4s high.m3u8

In any other machine

sudo ffmpeg -loglevel debug -y -analyzeduration 10M -probesize 10M -f hls -i http://69.79.26.106/transcode/fmp4test1/high.m3u8 -map 0 -codec copy -preset fast -f hls -hls_segment_type fmp4 -hls_time 5 -hls_list_size 725 -hls_flags delete_segments -hls_segment_filename high_%d.m4s high.m3u8

OR

ffplay http://69.79.26.106/transcode/fmp4test1/high.m3u8

This second set of commands fail, as they can't detect the pixel format and throw the partial file error.
I made sure the correct file format is returned in http. Been trying to fix it for weeks. Adding pix_fmt doesn't help here.

You can test using a short fmp4 hls stream I created:
http://69.79.26.106/transcode/fmp4test1/high.m3u8
As you can see, vlc and quicktime can play the video because they force the pixel format, however ffmpeg and ffplay fail to do so.

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (4)

comment:1 by Carl Eugen Hoyos, 5 years ago

Keywords: fmp4 pixel codec remote removed
Priority: importantnormal
      encoder         : Lavf58.20.100

Please test current FFmpeg git head and provide an actual command line that you tested and that produced a faulty stream together with the complete, uncut console output to make this a valid ticket (works fine here).

in reply to:  1 comment:2 by Offek, 5 years ago

Version: unspecifiedgit-master

Replying to cehoyos:

      encoder         : Lavf58.20.100

Please test current FFmpeg git head and provide an actual command line that you tested and that produced a faulty stream together with the complete, uncut console output to make this a valid ticket (works fine here).

Tested again with current git. Doesn't work. While the command to create an fmp4 stream seems to work fine and doesn't show any warnings or errors, it is unreadable using http from a remote machine (or even localhost). It is only readable with vlc and such other players that force a pixel format. I think the issue might come from the init.mp4 file the command creates with faulty pixel format info.

Here are the output of the commands:
Here is the command to make fmp4 hls stream, we will call it "the first ffmpeg command" (no issues appear here. The input stream is a passthrough ts stream I made from multicast. I tested on an external machine):

ffmpeg -y -analyzeduration 6M -probesize 6M -i "http://69.79.26.106/transcode/test/high.m3u8" -map 0 -profile:v main -bf 0 -preset faster -ar 48000 -crf 20 -b:a 96k -c:v h264 -c:a aac -f hls -hls_segment_type fmp4 -hls_time 5 -hls_list_size 12 -hls_flags delete_segments -hls_segment_filename high_%d.m4s high.m3u8
ffmpeg version N-92857-g3e461f9d4c Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
  configuration: --prefix=/home/offek/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/offek/ffmpeg_build/include --extra-ldflags=-L/home/offek/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/offek/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
  libavutil      56. 25.100 / 56. 25.100
  libavcodec     58. 42.104 / 58. 42.104
  libavformat    58. 25.100 / 58. 25.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 46.101 /  7. 46.101
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[hls,applehttp @ 0x5561d46cbc40] Opening 'http://69.79.26.106/transcode/test/high_1546266343.ts' for reading
[hls,applehttp @ 0x5561d46cbc40] Opening 'http://69.79.26.106/transcode/test/high_1546266347.ts' for reading
Input #0, hls,applehttp, from 'http://69.79.26.106/transcode/test/high.m3u8':
  Duration: N/A, start: 80557.423222, bitrate: N/A
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 352x480 [SAR 20:11 DAR 4:3], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
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
[libx264 @ 0x5561d46f9300] using SAR=20/11
[libx264 @ 0x5561d46f9300] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x5561d46f9300] profile Main, level 2.1
[libx264 @ 0x5561d46f9300] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=4 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=20 rc=crf mbtree=1 crf=20.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[hls @ 0x5561d46fdb00] Opening 'init.mp4' for writing
Output #0, hls, to 'high.m3u8':
  Metadata:
    encoder         : Lavf58.25.100
    Stream #0:0: Video: h264 (libx264), yuv420p, 352x480 [SAR 20:11 DAR 4:3], q=-1--1, 30 fps, 15360 tbn, 30 tbc
    Metadata:
      variant_bitrate : 0
      encoder         : Lavc58.42.104 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, 96 kb/s
    Metadata:
      variant_bitrate : 0
      encoder         : Lavc58.42.104 aac
frame=   34 fps=8.6 q=26.0 size=N/A time=00:00:01.12 bitrate=N/A speed=0.285x   frame=   47 fps=9.6 q=26.0 size=N/A time=00:00:01.59 bitrate=N/A speed=0.327x   frame=   57 fps=9.9 q=26.0 size=N/A time=00:00:01.91 bitrate=N/A speed=0.332x   frame=   68 fps= 10 q=26.0 size=N/A time=00:00:02.27 bitrate=N/A speed=0.348x   frame=   83 fps= 12 q=26.0 size=N/A time=00:00:02.72 bitrate=N/A speed=0.379x   frame=   96 fps= 12 q=26.0 size=N/A time=00:00:03.21 bitrate=N/A speed=0.414x   frame=  112 fps= 13 q=26.0 size=N/A time=00:00:03.74 bitrate=N/A speed=0.445x   [http @ 0x5561d46d3240] Opening 'http://69.79.26.106/transcode/test/high_1546266353.ts' for reading
frame=  116 fps= 13 q=26.0 size=N/A time=00:00:03.96 bitrate=N/A speed=0.438x   frame=  153 fps= 16 q=26.0 size=N/A time=00:00:05.09 bitrate=N/A speed=0.526x   frame=  163 fps= 16 q=26.0 size=N/A time=00:00:05.41 bitrate=N/A speed=0.516x   frame=  168 fps= 15 q=26.0 size=N/A time=00:00:05.62 bitrate=N/A speed=0.507x   frame=  177 fps= 15 q=26.0 size=N/A time=00:00:05.90 bitrate=N/A speed=0.503x   frame=  183 fps= 15 q=26.0 size=N/A time=00:00:06.07 bitrate=N/A speed=0.493x   frame=  188 fps= 13 q=26.0 size=N/A time=00:00:06.28 bitrate=N/A speed=0.445x   frame=  192 fps= 13 q=26.0 size=N/A time=00:00:06.39 bitrate=N/A speed=0.423x   frame=  202 fps= 13 q=26.0 size=N/A time=00:00:06.71 bitrate=N/A speed=0.423x   frame=  205 fps= 12 q=26.0 size=N/A time=00:00:06.88 bitrate=N/A speed=0.414x   frame=  217 fps= 12 q=26.0 size=N/A time=00:00:07.24 bitrate=N/A speed=0.416x   frame=  230 fps= 13 q=26.0 size=N/A time=00:00:07.69 bitrate=N/A speed=0.425x   frame=  235 fps= 13 q=26.0 size=N/A time=00:00:07.86 bitrate=N/A speed=0.422x   frame=  241 fps= 12 q=26.0 size=N/A time=00:00:08.05 bitrate=N/A speed=0.417x   [hls @ 0x5561d46fdb00] Opening 'high_0.m4s' for writingtrate=N/A speed=0.43x    
[hls @ 0x5561d46fdb00] Opening 'high.m3u8.tmp' for writing
frame=  280 fps= 13 q=26.0 size=N/A time=00:00:09.33 bitrate=N/A speed=0.443x   [http @ 0x5561d4743b40] Opening 'http://69.79.26.106/transcode/test/high.m3u8' for reading
[http @ 0x5561d46eef40] Opening 'http://69.79.26.106/transcode/test/high_1546266357.ts' for reading
frame=  296 fps= 14 q=26.0 size=N/A time=00:00:09.97 bitrate=N/A speed=0.459x   frame=  320 fps= 14 q=26.0 size=N/A time=00:00:10.65 bitrate=N/A speed=0.477x   frame=  344 fps= 15 q=26.0 size=N/A time=00:00:11.44 bitrate=N/A speed=0.497x   frame=  368 fps= 16 q=26.0 size=N/A time=00:00:12.23 bitrate=N/A speed=0.519x   frame=  402 fps= 17 q=26.0 size=N/A time=00:00:13.38 bitrate=N/A speed=0.557x   frame=  412 fps= 16 q=26.0 size=N/A time=00:00:13.70 bitrate=N/A speed=0.541x   [http @ 0x5561d46d3240] Opening 'http://69.79.26.106/transcode/test/high_1546266363.ts' for reading
frame=  494 fps= 19 q=26.0 size=N/A time=00:00:16.44 bitrate=N/A speed=0.636x   [hls @ 0x5561d46fdb00] Opening 'high_1.m4s' for writing
[hls @ 0x5561d46fdb00] Opening 'high.m3u8.tmp' for writing
[http @ 0x5561d4743b40] Opening 'http://69.79.26.106/transcode/test/high.m3u8' for reading
[http @ 0x5561d46eef40] Opening 'http://69.79.26.106/transcode/test/high_1546266367.ts' for reading
frame=  596 fps= 22 q=26.0 size=N/A time=00:00:19.96 bitrate=N/A speed=0.748x   frame=  658 fps= 24 q=26.0 size=N/A time=00:00:21.90 bitrate=N/A speed=0.802x   frame=  707 fps= 25 q=26.0 size=N/A time=00:00:23.52 bitrate=N/A speed=0.828x   [http @ 0x5561d46d3240] Opening 'http://69.79.26.106/transcode/test/high_1546266373.ts' for reading
frame=  760 fps= 26 q=26.0 size=N/A time=00:00:25.33 bitrate=N/A speed=0.876x   [hls @ 0x5561d46fdb00] Opening 'high_2.m4s' for writing
[hls @ 0x5561d46fdb00] Opening 'high.m3u8.tmp' for writing
[http @ 0x5561d46eef40] Opening 'http://69.79.26.106/transcode/test/high_1546266377.ts' for reading
[hls @ 0x5561d46fdb00] Opening 'high_3.m4s' for writingtrate=N/A speed=1.08x    
[hls @ 0x5561d46fdb00] Opening 'high.m3u8.tmp' for writing
[http @ 0x5561d4743b40] Opening 'http://69.79.26.106/transcode/test/high.m3u8' for reading
[http @ 0x5561d46eef40] Opening 'http://69.79.26.106/transcode/test/high_1546266383.ts' for reading
[hls @ 0x5561d46fdb00] Opening 'high_4.m4s' for writingtrate=N/A speed=1.22x    
[hls @ 0x5561d46fdb00] Opening 'high.m3u8.tmp' for writing
[http @ 0x5561d4743b40] Opening 'http://69.79.26.106/transcode/test/high.m3u8' for reading
[http @ 0x5561d46eef40] Opening 'http://69.79.26.106/transcode/test/high_1546266387.ts' for reading
[http @ 0x5561d46d3240] Opening 'http://69.79.26.106/transcode/test/high_1546266393.ts' for reading
[hls @ 0x5561d46fdb00] Opening 'high_5.m4s' for writingtrate=N/A speed= 1.1x    
[hls @ 0x5561d46fdb00] Opening 'high.m3u8.tmp' for writing
[http @ 0x5561d4743b40] Opening 'http://69.79.26.106/transcode/test/high.m3u8' for reading
[http @ 0x5561d46eef40] Opening 'http://69.79.26.106/transcode/test/high_1546266397.ts' for reading
[hls @ 0x5561d46fdb00] Opening 'high_6.m4s' for writingtrate=N/A speed=1.13x    
[hls @ 0x5561d46fdb00] Opening 'high.m3u8.tmp' for writing
[http @ 0x5561d4743b40] Opening 'http://69.79.26.106/transcode/test/high.m3u8' for reading
[http @ 0x5561d46eef40] Opening 'http://69.79.26.106/transcode/test/high_1546266403.ts' for reading
[hls @ 0x5561d46fdb00] Opening 'high_7.m4s' for writingtrate=N/A speed=1.16x    
....
....

As you see, no issues at all, and stream is playable in vlc.
However, when trying to play using ffplay, it fails:

ffplay http://192.168.1.95/transcode/vid/high.m3u8
ffplay version N-92857-g3e461f9d4c Copyright (c) 2003-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
  configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
  libavutil      56. 25.100 / 56. 25.100
  libavcodec     58. 42.104 / 58. 42.104
  libavformat    58. 25.100 / 58. 25.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 46.101 /  7. 46.101
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[hls,applehttp @ 0x7f4530000b80] Opening 'http://192.168.1.95/transcode/vid/init.mp4' for reading
[hls,applehttp @ 0x7f4530000b80] Opening 'http://192.168.1.95/transcode/vid/high_128.m4s' for reading
[hls,applehttp @ 0x7f4530000b80] Opening 'http://192.168.1.95/transcode/vid/high_129.m4s' for reading
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
[hls,applehttp @ 0x7f4530000b80] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 352x480, 5 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, hls,applehttp, from 'http://192.168.1.95/transcode/vid/high.m3u8':
  Duration: N/A, bitrate: 6 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (avc1 / 0x31637661), none, 352x480, 5 kb/s, 15360 tbr, 15360 tbn, 30720 tbc
    Metadata:
      variant_bitrate : 0
      major_brand     : iso5
      minor_version   : 512
      compatible_brands: iso6mp41
      encoder         : Lavf58.25.100
    Stream #0:1: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 0 kb/s
    Metadata:
      variant_bitrate : 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4530006e80] stream 0, offset 0x1673: partial file
    Last message repeated 2 times
....
....

ffprobe or any other ffmpeg command using this stream will cause an error right away:

ffprobe -i http://192.168.1.95/transcode/vid/high.m3u8
ffprobe version N-92857-g3e461f9d4c Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
  configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
  libavutil      56. 25.100 / 56. 25.100
  libavcodec     58. 42.104 / 58. 42.104
  libavformat    58. 25.100 / 58. 25.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 46.101 /  7. 46.101
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[hls,applehttp @ 0x557c6e0cec80] Opening 'http://192.168.1.95/transcode/vid/init.mp4' for reading
[hls,applehttp @ 0x557c6e0cec80] Opening 'http://192.168.1.95/transcode/vid/high_146.m4s' for reading
[hls,applehttp @ 0x557c6e0cec80] Opening 'http://192.168.1.95/transcode/vid/high_147.m4s' for reading
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557c6e0d50c0] stream 0, offset 0xf4f: partial file
[hls,applehttp @ 0x557c6e0cec80] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 352x480, 4 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, hls,applehttp, from 'http://192.168.1.95/transcode/vid/high.m3u8':
  Duration: N/A, bitrate: 5 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (avc1 / 0x31637661), none, 352x480, 4 kb/s, 15360 tbr, 15360 tbn, 30720 tbc
    Metadata:
      variant_bitrate : 0
      major_brand     : iso5
      minor_version   : 512
      compatible_brands: iso6mp41
      encoder         : Lavf58.25.100
    Stream #0:1: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 0 kb/s
    Metadata:
      variant_bitrate : 0

AND: (will call this "the second ffmpeg command")

ffmpeg -loglevel verbose -y -analyzeduration 10M -probesize 10M -i http://192.168.1.95/transcode/vid/high.m3u8 -map 0 -c:a copy -c:v copy -preset fast -threads 0 -f hls -hls_segment_type fmp4 -hls_time 5 -hls_list_size 725 -hls_flags delete_segments -hls_segment_filename high_%d.m4s high.m3u8
ffmpeg version N-92857-g3e461f9d4c Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
  configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
  libavutil      56. 25.100 / 56. 25.100
  libavcodec     58. 42.104 / 58. 42.104
  libavformat    58. 25.100 / 58. 25.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 46.101 /  7. 46.101
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[tcp @ 0x55ee6c553840] Starting connection attempt to 192.168.1.95 port 80
[tcp @ 0x55ee6c553840] Successfully connected to 192.168.1.95 port 80
[hls,applehttp @ 0x55ee6c550b40] HLS request for url 'http://192.168.1.95/transcode/vid/init.mp4', offset 0, playlist 0
[hls,applehttp @ 0x55ee6c550b40] Opening 'http://192.168.1.95/transcode/vid/init.mp4' for reading
[tcp @ 0x55ee6c55a280] Starting connection attempt to 192.168.1.95 port 80
[tcp @ 0x55ee6c55a280] Successfully connected to 192.168.1.95 port 80
[AVIOContext @ 0x55ee6c55a6c0] Statistics: 1311 bytes read, 0 seeks
[hls,applehttp @ 0x55ee6c550b40] HLS request for url 'http://192.168.1.95/transcode/vid/high_163.m4s', offset 0, playlist 0
[hls,applehttp @ 0x55ee6c550b40] Opening 'http://192.168.1.95/transcode/vid/high_163.m4s' for reading
[tcp @ 0x55ee6c55b400] Starting connection attempt to 192.168.1.95 port 80
[tcp @ 0x55ee6c55b400] Successfully connected to 192.168.1.95 port 80
[hls,applehttp @ 0x55ee6c550b40] HLS request for url 'http://192.168.1.95/transcode/vid/high_164.m4s', offset 0, playlist 0
[hls,applehttp @ 0x55ee6c550b40] Opening 'http://192.168.1.95/transcode/vid/high_164.m4s' for reading
[tcp @ 0x55ee6c56d980] Starting connection attempt to 192.168.1.95 port 80
[tcp @ 0x55ee6c56d980] Successfully connected to 192.168.1.95 port 80
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55ee6c5570c0] Reconfiguring buffers to size 1799418
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55ee6c5570c0] stream 0, offset 0x105b: partial file
[hls,applehttp @ 0x55ee6c550b40] Could not find codec parameters for stream 0 (Video: h264, 1 reference frame (avc1 / 0x31637661), none(left), 352x480, 7 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, hls,applehttp, from 'http://192.168.1.95/transcode/vid/high.m3u8':
  Duration: N/A, bitrate: 8 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264, 1 reference frame (avc1 / 0x31637661), none(left), 352x480, 7 kb/s, 15360 tbr, 15360 tbn, 30720 tbc
    Metadata:
      variant_bitrate : 0
      major_brand     : iso5
      minor_version   : 512
      compatible_brands: iso6mp41
      encoder         : Lavf58.25.100
    Stream #0:1: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 0 kb/s
    Metadata:
      variant_bitrate : 0
[hls @ 0x55ee6c5a94c0] Opening 'init.mp4' for writing
[mp4 @ 0x55ee6c59cd00] track 1: codec frame size is not set
Output #0, hls, to 'high.m3u8':
  Metadata:
    encoder         : Lavf58.25.100
    Stream #0:0: Video: h264, 1 reference frame (avc1 / 0x31637661), none(left), 352x480 (0x0), q=2-31, 7 kb/s, 15360 tbr, 15360 tbn, 15360 tbc
    Metadata:
      variant_bitrate : 0
      major_brand     : iso5
      minor_version   : 512
      compatible_brands: iso6mp41
      encoder         : Lavf58.25.100
    Stream #0:1: Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 0 kb/s
    Metadata:
      variant_bitrate : 0
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55ee6c5570c0] stream 0, offset 0x105b: partial file
http://192.168.1.95/transcode/vid/high.m3u8: Invalid data found when processing input
No more output streams to write to, finishing.
[AVIOContext @ 0x55ee6c5a0900] Statistics: 0 seeks, 1 writeouts
[hls @ 0x55ee6c5a94c0] Opening 'high_0.m4s' for writing
[AVIOContext @ 0x55ee6c5a0880] Statistics: 0 seeks, 1 writeouts
[hls @ 0x55ee6c5a94c0] Opening 'high.m3u8.tmp' for writing
EXT-X-MEDIA-SEQUENCE:0
[AVIOContext @ 0x55ee6c5a0880] Statistics: 0 seeks, 1 writeouts
frame=    0 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (http://192.168.1.95/transcode/vid/high.m3u8):
  Input stream #0:0 (video): 0 packets read (0 bytes); 
  Input stream #0:1 (audio): 0 packets read (0 bytes); 
  Total: 0 packets (0 bytes) demuxed
Output file #0 (high.m3u8):
  Output stream #0:0 (video): 0 packets muxed (0 bytes); 
  Output stream #0:1 (audio): 0 packets muxed (0 bytes); 
  Total: 0 packets (0 bytes) muxed
[AVIOContext @ 0x55ee6c55b900] Statistics: 33304 bytes read, 0 seeks
[AVIOContext @ 0x55ee6c56dc80] Statistics: 0 bytes read, 0 seeks
[AVIOContext @ 0x55ee6c55bc80] Statistics: 473 bytes read, 0 seeks

Check closely, the pixel format that is served from the fmp4 stream over http is always none. VLC can play it because it forces the pixel format.
From VLC log:

adaptive debug: opening playlist file (192.168.1.95/transcode/test/high.m3u8)
main debug: using demux module "adaptive"
main debug: looking for meta reader module matching "any": 2 candidates
main debug: creating demux: access='' demux='mp4' location='' file='(null)'
main debug: looking for demux module matching "mp4": 55 candidates
lua debug: Trying Lua scripts in /Users/Offek/Library/Application Support/org.videolan.vlc/lua/meta/reader
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/lua/meta/reader
lua debug: Trying Lua scripts in /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader
lua debug: Trying Lua playlist script /Applications/VLC.app/Contents/MacOS/share/lua/meta/reader/filename.luac
adaptive debug: Retrieving http://192.168.1.95:80/transcode/test/init.mp4 @0
main debug: resolving 192.168.1.95 ...
main debug: no meta reader modules matched
main debug: `http://192.168.1.95/transcode/test/high.m3u8' successfully opened
main debug: connecting to 192.168.1.95 port 80 ...
adaptive debug: Retrieving http://192.168.1.95:80/transcode/test/high_0.m4s @0
mp4 debug: dumping root Box "root"
mp4 debug: |   + ftyp size 24 offset 0
mp4 debug: |   + moov size 1287 offset 24
mp4 debug: |   |   + mvhd size 108 offset 32
mp4 debug: |   |   + trak size 538 offset 140
mp4 debug: |   |   |   + tkhd size 92 offset 148
mp4 debug: |   |   |   + edts size 48 offset 240
mp4 debug: |   |   |   |   + elst size 40 offset 248
mp4 debug: |   |   |   + mdia size 390 offset 288
mp4 debug: |   |   |   |   + mdhd size 32 offset 296
mp4 debug: |   |   |   |   + hdlr size 45 offset 328
mp4 debug: |   |   |   |   + minf size 305 offset 373
mp4 debug: |   |   |   |   |   + vmhd size 20 offset 381
mp4 debug: |   |   |   |   |   + dinf size 36 offset 401
mp4 debug: |   |   |   |   |   |   + dref size 28 offset 409
mp4 debug: |   |   |   |   |   |   |   + url  size 12 offset 425
mp4 debug: |   |   |   |   |   + stbl size 241 offset 437
mp4 debug: |   |   |   |   |   |   + stsd size 165 offset 445
mp4 debug: |   |   |   |   |   |   |   + avc1 size 149 offset 461
mp4 debug: |   |   |   |   |   |   |   |   + avcC size 47 offset 547
mp4 debug: |   |   |   |   |   |   |   |   + pasp size 16 offset 594
mp4 debug: |   |   |   |   |   |   + stts size 16 offset 610
mp4 debug: |   |   |   |   |   |   + stsc size 16 offset 626
mp4 debug: |   |   |   |   |   |   + stsz size 20 offset 642
mp4 debug: |   |   |   |   |   |   + stco size 16 offset 662
mp4 debug: |   |   + trak size 463 offset 678
mp4 debug: |   |   |   + tkhd size 92 offset 686
mp4 debug: |   |   |   + edts size 36 offset 778
mp4 debug: |   |   |   |   + elst size 28 offset 786
mp4 debug: |   |   |   + mdia size 327 offset 814
mp4 debug: |   |   |   |   + mdhd size 32 offset 822
mp4 debug: |   |   |   |   + hdlr size 45 offset 854
mp4 debug: |   |   |   |   + minf size 242 offset 899
mp4 debug: |   |   |   |   |   + smhd size 16 offset 907
mp4 debug: |   |   |   |   |   + dinf size 36 offset 923
mp4 debug: |   |   |   |   |   |   + dref size 28 offset 931
mp4 debug: |   |   |   |   |   |   |   + url  size 12 offset 947
mp4 debug: |   |   |   |   |   + stbl size 182 offset 959
mp4 debug: |   |   |   |   |   |   + stsd size 106 offset 967
mp4 debug: |   |   |   |   |   |   |   + mp4a size 90 offset 983
mp4 debug: |   |   |   |   |   |   |   |   + esds size 54 offset 1019
mp4 debug: |   |   |   |   |   |   + stts size 16 offset 1073
mp4 debug: |   |   |   |   |   |   + stsc size 16 offset 1089
mp4 debug: |   |   |   |   |   |   + stsz size 20 offset 1105
mp4 debug: |   |   |   |   |   |   + stco size 16 offset 1125
mp4 debug: |   |   + mvex size 72 offset 1141
mp4 debug: |   |   |   + trex size 32 offset 1149
mp4 debug: |   |   |   + trex size 32 offset 1181
mp4 debug: |   |   + udta size 98 offset 1213
mp4 debug: |   |   |   + meta size 90 offset 1221
mp4 debug: |   |   |   |   + hdlr size 33 offset 1233
mp4 debug: |   |   |   |   + ilst size 45 offset 1266
mp4 debug: |   |   |   |   |   + ctoo size 37 offset 1274
mp4 debug: |   |   |   |   |   |   + data size 29 offset 1282
mp4 debug: |   + styp size 24 offset 1311
mp4 debug: |   + sidx size 52 offset 1335
mp4 debug: unrecognized major media specification (iso5).
mp4 debug: found 2 tracks
mp4 warning: elst box found
mp4 debug:    - [0] duration=2ms media time=-1ms) rate=1.0
mp4 debug:    - [1] duration=0ms media time=0ms) rate=1.0
mp4 warning: no chunk defined
mp4 debug: track[Id 0x1] read 0 chunk
mp4 warning: STTS table of 0 entries
mp4 debug: track[Id 0x1] read 0 samples length:0s
mp4 debug: adding track[Id 0x1] video (enable) language undef
mp4 warning: elst box found
mp4 debug:    - [0] duration=0ms media time=0ms) rate=1.0
mp4 warning: no chunk defined
mp4 debug: track[Id 0x2] read 0 chunk
mp4 warning: STTS table of 0 entries
mp4 debug: track[Id 0x2] read 0 samples length:0s
mp4 debug: adding track[Id 0x2] audio (enable) language undef
mp4 debug: Set Fragmented demux mode
mp4 warning: that media doesn't look interleaved, will need to seek
main debug: using demux module "mp4"
mp4 debug: track 1 enabled!
mp4 debug: track 2 enabled!
mp4 info: Fragment sequence discontinuity detected 1 != 0
macosx debug: Activated assertion NoIdleSleepAssertion through IOKit (40391)
adaptive debug: Retrieving http://192.168.1.95:80/transcode/test/high_1.m4s @0
main debug: selecting program id=0
main debug: looking for video decoder module matching "any": 14 candidates
videotoolbox debug: new SPS parsed: 0
videotoolbox debug: new PPS parsed: 0
videotoolbox warning: forcing CVPX format: 420v
videotoolbox info: Using Video Toolbox to decode 'h264'
main debug: using video decoder module "videotoolbox"
main debug: looking for audio decoder module matching "any": 21 candidates
main debug: using audio decoder module "faad"
main debug: Buffering 0%
faad warning: decoded zero sample
main debug: reusing audio output
main debug: VLC is looking for: 'f32l' 48000 Hz Stereo frame=1 samples/8 bytes

The key line I believe is:
videotoolbox warning: forcing CVPX format: 420v

I couldn't find a way to force ffmpeg to specify a pixel format for the input of the ffplay, ffprobe, or "the second ffmpeg" command.
Sorry for the long post I really dug deep into this and would love to help solve it.

comment:3 by Offek, 5 years ago

I made a public ffmpeg fmp4 hls stream you could use to try and play or rebroadcast from your side.
Please feel free to look at it and use it while I keep it working:

http://69.79.26.106/transcode/fmp4test/high.m3u8

You can use ffprobe to see the error I was referring to:

ffprobe -i http://69.79.26.106/transcode/fmp4test/high.m3u8

comment:4 by Yukun Guo, 5 years ago

I have run into the same problem. "partial file" is reported when a call to avio_seek reaches here: https://github.com/FFmpeg/FFmpeg/blob/n4.1.3/libavformat/aviobuf.c#L318. This is not due to "faulty codec parameters", but an unnecessary buffer reconfiguring operation on the non-seekable input stream. There is already a patch: https://patchwork.ffmpeg.org/patch/11744/ (not sure why it is suspended).

Some other observations:

  • If you concatenate the initialization segment 'init.mp4' and a '.m4s' media segment together, and ask FFmpeg to pull the file via HTTP, then the file can only be correctly demuxed when the HTTP server supports range requests. Otherwise, a "partial file" error still occurs.
  • Interleaved MP4 can be demuxed successfully, because it doesn't trigger ffio_set_buf_size in ff_configure_buffers_for_index. Although the OP's command generates a non-interleaved MP4, the duration of the first '.m4s' is only 0.5 second, so it's effectively an interleaved one. After removing the first segment, you will encounter the same problem.
Note: See TracTickets for help on using tickets.