ffmpeg: No trailing CRLF found in HTTP header
This comment is right:
It's a warning, not an error.
ffmpeg
appends the trailing CRLF on its own and proceeds.
My answer explains why the tool cannot "see" CRLF even if you use \r\n
in printf
. It's because of $()
. POSIX specification says [emphasis mine]:
$(command)
[...]
The shell shall expand the command substitution by executing
command
in a subshell environment [...] and replacing the command substitution (the text ofcommand
plus the enclosing$()
or backquotes) with the standard output of the command, removing sequences of one or more <newline> characters at the end of the substitution.
So there's no way to get a trailing \n
from $()
.
You can ask your shell to add trailing newlines, although not all shells support this. In Bash instead of
foo "$(printf '\n%s\r\n' 'bar')"
use
foo "$(printf '\n%s' 'bar')"$'\r\n'
See How does the leading dollar sign affect single quotes in Bash?
Related videos on Youtube
nadermx
Updated on September 18, 2022Comments
-
nadermx over 1 year
I'm trying to use the
-headers
command in ffmpeg, but with the following command I'm getting aNo trailing CRLF found in HTTP header
error.ffmpeg -headers "$(printf '\n%s\n%s\n%s\n%s\n%s\n%s\n\n' 'Cookie: GPS=1; PREF=f1=50000000&hl=en; VISITOR_INFO1_LIVE=YYVg5wZlZM4; YSC=nqFTzbjynHk; s_gl=1d69aac621b2f9c0a25dade722d6e24bcwIAAABVUw==' 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0' 'Accept-Encoding: gzip, deflate' 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7' 'Accept-Language: en-us,en;q=0.5')" -i http://localhost:8000 -v trace
This is the ffmpeg
-v
output (Note I've also tried with\r\n
,\\r\\n
,\\n
as well instead of just\n
still get the same error (the double incase of printf escape)ffmpeg -headers "$(printf '\n%s\n%s\n%s\n%s\n%s\n%s\n\n' 'Cookie: GPS=1; PREF=f1=50000000&hl=en; VISITOR_INFO1_LIVE=YYVg5wZlZM4; YSC=nqFTzbjynHk; s_gl=1d69aac621b2f9c0a25dade722d6e24bcwIAAABVUw==' 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0' 'Accept-Encoding: gzip, deflate' 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7' 'Accept-Language: en-us,en;q=0.5')" -i http://localhost:8000 -v trace ffmpeg version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu3) configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared libavutil 55. 78.100 / 55. 78.100 libavcodec 57.107.100 / 57.107.100 libavformat 57. 83.100 / 57. 83.100 libavdevice 57. 10.100 / 57. 10.100 libavfilter 6.107.100 / 6.107.100 libavresample 3. 7. 0 / 3. 7. 0 libswscale 4. 8.100 / 4. 8.100 libswresample 2. 9.100 / 2. 9.100 libpostproc 54. 7.100 / 54. 7.100 Splitting the commandline. Reading option '-headers' ... matched as AVOption 'headers' with argument ' Cookie: GPS=1; PREF=f1=50000000&hl=en; VISITOR_INFO1_LIVE=YYVg5wZlZM4; YSC=nqFTzbjynHk; s_gl=1d69aac621b2f9c0a25dade722d6e24bcwIAAABVUw== User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0 Accept-Encoding: gzip, deflate Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Accept-Language: en-us,en;q=0.5'. Reading option '-i' ... matched as input url with argument 'http://localhost:8000'. Reading option '-v' ... matched as option 'v' (set logging level) with argument 'trace'. Finished splitting the commandline. Parsing a group of options: global . Applying option v (set logging level) with argument trace. Successfully parsed a group of options. Parsing a group of options: input url http://localhost:8000. Successfully parsed a group of options. Opening an input file: http://localhost:8000. [NULL @ 0x556cf5231a60] Opening 'http://localhost:8000' for reading [http @ 0x556cf5232780] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy' [http @ 0x556cf5232780] No trailing CRLF found in HTTP header. [http @ 0x556cf5232780] request: GET / HTTP/1.1 User-Agent: Lavf/57.83.100 Accept: */* Range: bytes=0- Connection: close Host: localhost:8000 Icy-MetaData: 1 Cookie: GPS=1; PREF=f1=50000000&hl=en; VISITOR_INFO1_LIVE=YYVg5wZlZM4; YSC=nqFTzbjynHk; s_gl=1d69aac621b2f9c0a25dade722d6e24bcwIAAABVUw== User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0 Accept-Encoding: gzip, deflate Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Accept-Language: en-us,en;q=0.5 [http @ 0x556cf5232780] header='HTTP/1.0 200 OK' [http @ 0x556cf5232780] http_code=200
-
Gyan over 5 yearsWhat's the issue? It's a warning, not an error. ffmpeg appends the trailing CRLF on its own and proceeds.
-