I am having a problem trying to extract thumbnails from a movie file with a specific timestamp. As a rule, I had no problems with this, but I came across a set of movie files that get an error in the requested range of bytes (416 Requested Range Not Satisfiable).
It is strange that the server correctly returns the length of the content in the partial content request, but when it requests a movie file, it requests a length that exceeds this.
It's a little over my head, so I'm not sure what can happen here. Any insight would be great.
Command:
/usr/bin/ffmpeg -y -ss 1400 -i 'https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4' -qscale:v 2 -f image2 -vframes 1 -filter:v 'scale=192:108' -loglevel debug /data/www/storage/test.jpg 2>&1
Error:
[https @ 0x22e1e00] header='HTTP/1.1 416 Requested Range Not Satisfiable' [https @ 0x22e1e00] http_code=416 [https @ 0x22e1e00] HTTP error 416 Requested Range Not Satisfiable
Source File Size:
1776706045 bytes
Content Content Duration:
2897.624271
Partial Content Request:
[https @ 0x22e1e00] header='HTTP/1.1 206 Partial Content' [https @ 0x22e1e00] http_code=206 [https @ 0x22e1e00] header='x-amz-id-2: 4J1pgHExIUA0GxIxSBmGJjrRqliHbsIjXeuGzVfTlaaoVXbyZI5FQNma8fGaifcovkXfxJev5yU=' [https @ 0x22e1e00] header='x-amz-request-id: 78B3BDBB0356EF40' [https @ 0x22e1e00] header='Date: Wed, 16 Dec 2015 23:51:29 GMT' [https @ 0x22e1e00] header='x-amz-meta-content-length: 2898' [https @ 0x22e1e00] header='x-amz-meta-cb-modifiedtime: Tue, 15 Dec 2015 17:59:51 GMT' [https @ 0x22e1e00] header='Last-Modified: Wed, 16 Dec 2015 23:44:59 GMT' [https @ 0x22e1e00] header='ETag: "6341a8022630667a8070a83575e542e7-27"' [https @ 0x22e1e00] header='Accept-Ranges: bytes' [https @ 0x22e1e00] header='Content-Range: bytes 0-1776706044/1776706045' [https @ 0x22e1e00] header='Content-Type: video/mp4' [https @ 0x22e1e00] header='Content-Length: 1776706045' [https @ 0x22e1e00] header='Server: AmazonS3' [https @ 0x22e1e00] header='Connection: close'
FFmpeg request:
request: GET /my-bucket/mymoviefile.mp4 HTTP/1.1 User-Agent: Lavf/56.25.101 Accept: */* Range: bytes=1781732960- Connection: close Host: s3-us-west-2.amazonaws.com Icy-MetaData: 1
Whole magazine:
# /usr/bin/ffmpeg -y -ss 1400 -i 'https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4' -qscale:v 2 -f image2 -vframes 1 -filter:v 'scale=192:108' -loglevel debug /data/www/storage/test.jpg 2>&1 ffmpeg version 2.6.4 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.9.2 (Debian 4.9.2-10) configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu libavutil 54. 20.100 / 54. 20.100 libavcodec 56. 26.100 / 56. 26.100 libavformat 56. 25.101 / 56. 25.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 11.102 / 5. 11.102 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Splitting the commandline. Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'. Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '1400'. Reading option '-i' ... matched as input file with argument 'https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4'. Reading option '-qscale:v' ... matched as option 'qscale' (use fixed quality scale (VBR)) with argument '2'. Reading option '-f' ... matched as option 'f' (force format) with argument 'image2'. Reading option '-vframes' ... matched as option 'vframes' (set the number of video frames to output) with argument '1'. Reading option '-filter:v' ... matched as option 'filter' (set stream filtergraph) with argument 'scale=192:108'. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. Reading option '/data/www/storage/test.jpg' ... matched as output file. Finished splitting the commandline. Parsing a group of options: global . Applying option y (overwrite output files) with argument 1. Applying option loglevel (set logging level) with argument debug. Successfully parsed a group of options. Parsing a group of options: input file https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4. Applying option ss (set the start time offset) with argument 1400. Successfully parsed a group of options. Opening an input file: https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4. [https @ 0x22e1e00] request: GET /my-bucket/mymoviefile.mp4 HTTP/1.1 User-Agent: Lavf/56.25.101 Accept: */* Range: bytes=0- Connection: close Host: s3-us-west-2.amazonaws.com Icy-MetaData: 1 [https @ 0x22e1e00] header='HTTP/1.1 206 Partial Content' [https @ 0x22e1e00] http_code=206 [https @ 0x22e1e00] header='x-amz-id-2: 4J1pgHExIUA0GxIxSBmGJjrRqliHbsIjXeuGzVfTlaaoVXbyZI5FQNma8fGaifcovkXfxJev5yU=' [https @ 0x22e1e00] header='x-amz-request-id: 78B3BDBB0356EF40' [https @ 0x22e1e00] header='Date: Wed, 16 Dec 2015 23:51:29 GMT' [https @ 0x22e1e00] header='x-amz-meta-content-length: 2898' [https @ 0x22e1e00] header='x-amz-meta-cb-modifiedtime: Tue, 15 Dec 2015 17:59:51 GMT' [https @ 0x22e1e00] header='Last-Modified: Wed, 16 Dec 2015 23:44:59 GMT' [https @ 0x22e1e00] header='ETag: "6341a8022630667a8070a83575e542e7-27"' [https @ 0x22e1e00] header='Accept-Ranges: bytes' [https @ 0x22e1e00] header='Content-Range: bytes 0-1776706044/1776706045' [https @ 0x22e1e00] header='Content-Type: video/mp4' [https @ 0x22e1e00] header='Content-Length: 1776706045' [https @ 0x22e1e00] header='Server: AmazonS3' [https @ 0x22e1e00] header='Connection: close' [https @ 0x22e1e00] header='' [mov,mp4,m4a,3gp,3g2,mj2 @ 0x22e1740] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x22e1740] ISO: File Type Major Brand: mp42 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x22e1740] Before avformat_find_stream_info() pos: 1647960 bytes read:1652200 seeks:0 [h264 @ 0x22e92c0] no picture [mov,mp4,m4a,3gp,3g2,mj2 @ 0x22e1740] All info found [mov,mp4,m4a,3gp,3g2,mj2 @ 0x22e1740] After avformat_find_stream_info() pos: 1862326 bytes read:1878504 seeks:0 frames:16 Input
Result of FFprobe:
# /usr/bin/ffprobe -show_format -show_streams -i 'https://s3-us-west-2.amazonaws.com/my-bucket/mymoviefile.mp4' ffprobe version 2.6.4 Copyright (c) 2007-2015 the FFmpeg developers built with gcc 4.9.2 (Debian 4.9.2-10) configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu libavutil 54. 20.100 / 54. 20.100 libavcodec 56. 26.100 / 56. 26.100 libavformat 56. 25.101 / 56. 25.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 11.102 / 5. 11.102 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Input