FFMPEG streaming error: Failed to update header with correct filesize and duration

13,135

I found the answer to this question in another thread.

At the end of muxing a flv file, FFmpeg updates the header (at front of file) with duration and filesize values. However, when you are streaming, ffmpeg can't seek to the front, so the warnings are displayed.

You can disable this function, by adding a flag (-flvflags no_duration_filesize), e.g.:

ffmpeg -re -i SampleM.flv -acodec libmp3lame -ar 44100 -b:a 128k \
 -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 6000k \
 -vb 400k -maxrate 1500k -deinterlace -vcodec libx264           \
 -preset veryfast -g 30 -r 30 -f flv                            \
 -flvflags no_duration_filesize                                 \
 "rtmp://live-api.facebook.com:80/rtmp/my_key"

Source: FFMPEG- Streaming Stops after few seconds

Share:
13,135

Related videos on Youtube

Brindha Kanniah
Author by

Brindha Kanniah

MIT undergrad majoring in Electrical Engineering and Physics, with a research interest in marine robotics.

Updated on June 04, 2022

Comments

  • Brindha Kanniah
    Brindha Kanniah almost 2 years

    I am trying to stream an mp4 to a vlc player on my local computer at ip address 127.0.0.1:48550, but am encountering this error.

    Failed to update header with correct duration.
    Failed to update header with correct filesize.
    

    I didn't have this problem when streaming on my mac, but am encountering it with a Windows pc.

    On my mac I am running ffmpeg 3.2.4, and on the pc, ffmpeg version N-86755-g0780ad9 built with gcc 7.1.0.

    Below is the VLC media player debug log:

    core debug: adding item `udp://127.0.0.1:48550' ( udp://127.0.0.1:48550 )
    core debug: processing request item: udp://127.0.0.1:48550, node: null, skip: 0
    core debug: rebuilding array of current - root Playlist
    core debug: rebuild done - 1 items, index 0
    core debug: starting playback of the new playlist item
    core debug: resyncing on udp://127.0.0.1:48550
    core debug: udp://127.0.0.1:48550 is at 0
    core debug: creating new input thread
    core debug: Creating an input for 'udp://127.0.0.1:48550'
    core debug: meta ok for (null), need to fetch art
    core debug: requesting art for udp://127.0.0.1:48550
    core debug: looking for meta fetcher module matching "any": 1 candidates
    core debug: using timeshift granularity of 50 MiB, in path 'C:\Users\Oculus\AppData\Local\Temp'
    core debug: looking for meta fetcher module matching "any": 1 candidates
    core debug: `udp://127.0.0.1:48550' gives access `udp' demux `' path `127.0.0.1:48550'
    core debug: specified demux `any'
    core debug: creating demux: access='udp' demux='any' location='127.0.0.1:48550' file='\\127.0.0.1:48550'
    core debug: looking for access_demux module matching "udp": 12 candidates
    core debug: no access_demux modules matched
    core debug: creating access 'udp' location='127.0.0.1:48550', path='\\127.0.0.1:48550'
    core debug: looking for access module matching "udp": 21 candidates
    lua debug: Trying Lua scripts in C:\Users\Oculus\AppData\Roaming\vlc\lua\meta\fetcher
    lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\fetcher
    lua debug: Trying Lua scripts in C:\Users\Oculus\AppData\Roaming\vlc\lua\meta\fetcher
    lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\fetcher
    lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\fetcher\tvrage.luac
    lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\fetcher\tvrage.luac
    udp debug: opening server=127.0.0.1:48550 local=:1234
    core debug: net: connecting to [127.0.0.1]:48550 from []:1234
    lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\fetcher\tvrage.luac
    lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\fetcher\tvrage.luac
    core debug: no meta fetcher modules matched
    core debug: searching art for udp://127.0.0.1:48550
    core debug: looking for art finder module matching "any": 2 candidates
    core debug: no meta fetcher modules matched
    core debug: searching art for udp://127.0.0.1:48550
    core debug: looking for art finder module matching "any": 2 candidates
    lua debug: Trying Lua scripts in C:\Users\Oculus\AppData\Roaming\vlc\lua\meta\art
    lua debug: Trying Lua scripts in C:\Users\Oculus\AppData\Roaming\vlc\lua\meta\art
    lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\art
    lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\art
    lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\00_musicbrainz.luac
    lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\00_musicbrainz.luac
    lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\00_musicbrainz.luac
    lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\00_musicbrainz.luac
    lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\01_googleimage.luac
    lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\01_googleimage.luac
    lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\01_googleimage.luac
    lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\01_googleimage.luac
    lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\02_frenchtv.luac
    lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\02_frenchtv.luac
    lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\02_frenchtv.luac
    lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\02_frenchtv.luac
    lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\03_lastfm.luac
    lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\03_lastfm.luac
    lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\03_lastfm.luac
    lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\03_lastfm.luac
    core debug: no art finder modules matched
    core debug: art not found for udp://127.0.0.1:48550
    core debug: no art finder modules matched
    core debug: art not found for udp://127.0.0.1:48550
    core debug: using access module "udp"
    core debug: Using block method for AStream*
    core debug: starting pre-buffering
    qt4 debug: IM: Setting an input
    

    Thoughts on why this is happening? And on how to resolve this?

    • Salih Karagoz
      Salih Karagoz almost 7 years
      Please share Debug log. (Vlc Media player --> Tool--> Messages, Select Debug(2) hit enter. Then start your stream open again tools, messages share results.
    • Brindha Kanniah
      Brindha Kanniah almost 7 years
      Added the VLC log to the question, thanks @SalihKaragöz!
    • Salih Karagoz
      Salih Karagoz almost 7 years
      your setting is wrong.
  • Brindha Kanniah
    Brindha Kanniah almost 7 years
    Right, however I want to do all of the above using ffmpeg, by running it via the command prompt. See [https://stackoverflow.com/questions/45141199/… for the command line instructions I am using to stream the video via ffmpeg to the vlc player. VLC will simply function as a player that ¨receives¨ the stream. Are my VLC settings wrong in that case? Currently I am opening a network stream in VLC, to play the file. @SalihKaragoz
  • Salih Karagoz
    Salih Karagoz almost 7 years
    I understood "You want to make stream with VLC Media Player". In that case, your setting is true for "Open or get the stream". @BrindhaKanniah