Ffmpeg issues multiple HTTP requests when starting a video from a URL

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Ffmpeg issues multiple HTTP requests when starting a video from a URL

Vladimir Grishchenko
I'm using ffmpeg to read an mp4 video from a HTTP URL and in some cases it issues up to 3 HTTP calls before it actually starts the conversion. There is no attempt to seek the video on the command line. The server returns HTTP/1.1 206 Partial Content initially and ffmpeg then tries to get data at different offsets before it prints "All info found" and proceeds with the conversion. Multiple connections cause an additional delay which I'd like to avoid no matter how small it is. Is there a mechanism to override this behavior and have ffmpeg to work with the data stream as it is being read? I'm using version 4.2.1. Thanks.

-Vlad


_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Ffmpeg issues multiple HTTP requests when starting a video from a URL

Vladimir Grishchenko
A bit more details. I don't fully understand why 3 connections are necessary to begin the conversion. My best guess is ffmpeg detects some sort of inconsistency from the initial data and tries to confirm additional details by analyzing the end if the file.

First connection opened with Range: bytes=0-:

[https @ 000001faa550d840] [] header='HTTP/1.1 206 Partial Content'
....
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [debug] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'ftyp' parent:'root' sz: 32 8 9495632
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [debug] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'free' parent:'root' sz: 8 40 9495632
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'mdat' parent:'root' sz: 9468817 48 9495632

Then presumably the first connection is closed, and the second connection is opened with Range: bytes=9468857- header, this offset is close to the end of the file, and this output is generated:

[https @ 000001faa550d840] [] header='HTTP/1.1 206 Partial Content'
...
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'moov' parent:'root' sz: 26775 9468865 9495632
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'mvhd' parent:'moov' sz: 108 8 26767
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] time scale = 1000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'trak' parent:'moov' sz: 7933 116 26767
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'tkhd' parent:'trak' sz: 92 8 7925
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'edts' parent:'trak' sz: 36 100 7925
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'elst' parent:'edts' sz: 28 8 28
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] track[0].edit_count = 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] duration=30008 time=0 rate=1.000000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'mdia' parent:'trak' sz: 7797 136 7925
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'mdhd' parent:'mdia' sz: 32 8 7789
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'hdlr' parent:'mdia' sz: 45 40 7789
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] ctype=[0][0][0][0]
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] stype=vide
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'minf' parent:'mdia' sz: 7712 85 7789
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'vmhd' parent:'minf' sz: 20 8 7704
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'dinf' parent:'minf' sz: 36 28 7704
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'dref' parent:'dinf' sz: 28 8 28
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [debug] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stbl' parent:'minf' sz: 7648 64 7704
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stsd' parent:'stbl' sz: 176 8 7640
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] size=160 4CC=avc1 codec_type=0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'avcC' parent:'stsd' sz: 58 8 74
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'pasp' parent:'stsd' sz: 16 66 74
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stts' parent:'stbl' sz: 32 184 7640
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] track[0].stts.entries = 2
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] sample_count=899, sample_duration=1001
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] sample_count=1, sample_duration=341
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stss' parent:'stbl' sz: 160 216 7640
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] keyframe_count = 36
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stsc' parent:'stbl' sz: 40 376 7640
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] track[0].stsc.entries = 2
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stsz' parent:'stbl' sz: 3620 416 7640
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] sample_size = 0 sample_count = 900
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stco' parent:'stbl' sz: 3612 4036 7640
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 0, sample 0, offset 30, dts 0, size 76339, distance 0, keyframe 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 0, sample 1, offset 12e25, dts 1001, size 1230, distance 1, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 0, sample 2, offset 134ec, dts 2002, size 1462, distance 2, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 0, sample 3, offset 13e90, dts 3003, size 2454, distance 3, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 0, sample 4, offset 14a5b, dts 4004, size 2478, distance 4, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 0, sample 5, offset 15849, dts 5005, size 2031, distance 5, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 0, sample 6, offset 1621e, dts 6006, size 5535, distance 6, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 0, sample 7, offset 17beb, dts 7007, size 2850, distance 7, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 0, sample 8, offset 18938, dts 8008, size 4666, distance 8, keyframe 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 0, sample 9, offset 19d81, dts 9009, size 5106, distance 9, keyframe 0
....
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [debug] Processing st: 0, edit list 0 - media time: 0, duration: 900240
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'trak' parent:'moov' sz: 18628 8049 26767
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'tkhd' parent:'trak' sz: 92 8 18620
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'edts' parent:'trak' sz: 36 100 18620
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'elst' parent:'edts' sz: 28 8 28
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] track[1].edit_count = 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] duration=29954 time=0 rate=1.000000
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'mdia' parent:'trak' sz: 18492 136 18620
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'mdhd' parent:'mdia' sz: 32 8 18484
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'hdlr' parent:'mdia' sz: 45 40 18484
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] ctype=[0][0][0][0]
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] stype=soun
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'minf' parent:'mdia' sz: 18407 85 18484
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'smhd' parent:'minf' sz: 16 8 18399
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'dinf' parent:'minf' sz: 36 24 18399
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'dref' parent:'dinf' sz: 28 8 28
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [debug] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stbl' parent:'minf' sz: 18347 60 18399
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stsd' parent:'stbl' sz: 103 8 18339
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] size=87 4CC=mp4a codec_type=1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] audio channels 2
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] version =0, isom =1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'esds' parent:'stsd' sz: 51 8 51
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] MPEG-4 description: tag=0x03 len=34
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] MPEG-4 description: tag=0x04 len=20
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] esds object type id 0x40
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] MPEG-4 description: tag=0x05 len=2
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] Specific MPEG-4 header len=2
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] mp4a config channels 2 obj 2 ext obj 0 sample rate 44100 ext sample rate 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stts' parent:'stbl' sz: 24 111 18339
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] track[1].stts.entries = 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] sample_count=1290, sample_duration=1024
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stsc' parent:'stbl' sz: 9424 135 18339
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] track[1].stsc.entries = 784
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stsz' parent:'stbl' sz: 5180 9559 18339
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] sample_size = 0 sample_count = 1290
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'stco' parent:'stbl' sz: 3608 14739 18339
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 1, sample 0, offset 12a63, dts 0, size 472, distance 0, keyframe 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 1, sample 1, offset 12c3b, dts 1024, size 490, distance 0, keyframe 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 1, sample 2, offset 132f3, dts 2048, size 505, distance 0, keyframe 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 1, sample 3, offset 13aa2, dts 3072, size 500, distance 0, keyframe 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 1, sample 4, offset 13c96, dts 4096, size 506, distance 0, keyframe 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 1, sample 5, offset 14826, dts 5120, size 565, distance 0, keyframe 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] AVIndex stream 1, sample 6, offset 15409, dts 6144, size 564, distance 0, keyframe 1
....
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [debug] Processing st: 1, edit list 0 - media time: 0, duration: 1320971
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'udta' parent:'moov' sz: 98 26677 26767
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'meta' parent:'udta' sz: 90 8 90
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'hdlr' parent:'meta' sz: 33 8 78
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] ctype=[0][0][0][0]
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] stype=mdir
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'ilst' parent:'meta' sz: 45 41 78
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'[169]too' parent:'ilst' sz: 37 8 37
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] on_parse_exit_offset=9495632
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [debug] Before avformat_find_stream_info() pos: 9495632 bytes read:43135 seeks:1 nb_streams:2
[h264 @ 000001faa5a04a00] [debug] nal_unit_type: 7(SPS), nal_ref_idc: 1
[h264 @ 000001faa5a04a00] [debug] nal_unit_type: 8(PPS), nal_ref_idc: 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] stream 0, sample 0, dts 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] stream 1, sample 0, dts 0


And finally the third connection is opened with Range: bytes=48-  and the conversion starts, no additional connections are opened.


[https @ 000001faa550d840] [] header='HTTP/1.1 206 Partial Content'
...
[h264 @ 000001faa5a04a00] [debug] nal_unit_type: 6(SEI), nal_ref_idc: 0
[h264 @ 000001faa5a04a00] [debug] nal_unit_type: 5(IDR), nal_ref_idc: 1
[h264 @ 000001faa5a04a00] [debug] ct_type:0 pic_struct:0
[h264 @ 000001faa5a04a00] [debug] Format yuv420p chosen by get_format().
[h264 @ 000001faa5a04a00] [verbose] Reinit context to 1280x720, pix_fmt: yuv420p
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] stream 0, sample 1, dts 33367
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] stream 1, sample 0, dts 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [debug] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] stream 0: start_time: 0.000 duration: 30.008
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] stream 1: start_time: 0.000 duration: 29.954
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] format: start_time: 0.000 duration: 30.008 bitrate=2531 kb/s
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [debug] After avformat_find_stream_info() pos: 76859 bytes read:129305 seeks:2 frames:2
[info] Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://host/file.mp4':
[info]   Metadata:
[info]     major_brand     : isom
[info]     minor_version   : 512
[info]     compatible_brands: isomiso2avc1mp41
[info]     encoder         : Lavf57.71.100
[info]   Duration: 00:00:30.01, start: 0.000000, bitrate: 2531 kb/s
[info]     Stream #0:0(und), 1, 1/30000: Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 2330 kb/s, 29.99 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
[info]     Metadata:
[info]       handler_name    : VideoHandler
[info]     Stream #0:1(und), 1, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 194 kb/s (default)
[info]     Metadata:
[info]       handler_name    : SoundHandler
[debug] Successfully opened the file.



________________________________
From: ffmpeg-user <[hidden email]> on behalf of Vladimir Grishchenko <[hidden email]>
Sent: Thursday, July 16, 2020 5:04 PM
To: [hidden email] <[hidden email]>
Subject: [FFmpeg-user] Ffmpeg issues multiple HTTP requests when starting a video from a URL

I'm using ffmpeg to read an mp4 video from a HTTP URL and in some cases it issues up to 3 HTTP calls before it actually starts the conversion. There is no attempt to seek the video on the command line. The server returns HTTP/1.1 206 Partial Content initially and ffmpeg then tries to get data at different offsets before it prints "All info found" and proceeds with the conversion. Multiple connections cause an additional delay which I'd like to avoid no matter how small it is. Is there a mechanism to override this behavior and have ffmpeg to work with the data stream as it is being read? I'm using version 4.2.1. Thanks.

-Vlad


_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Ffmpeg issues multiple HTTP requests when starting a video from a URL

Carl Eugen Hoyos-2
Am Fr., 17. Juli 2020 um 08:21 Uhr schrieb Vladimir Grishchenko
<[hidden email]>:
>
> A bit more details.

But still not enough.

When asking for support here, please always provide the command line
you tested together
with the complete, uncut console output.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Ffmpeg issues multiple HTTP requests when starting a video from a URL

kumowoon1025
In reply to this post by Vladimir Grishchenko
Hi,

> There is no attempt to seek the video on the command line. The server returns HTTP/1.1 206 Partial Content initially and ffmpeg then tries to get data at different offsets before it prints "All info found" and proceeds with the conversion. Multiple connections cause an additional delay which I'd like to avoid no matter how small it is. Is there a mechanism to override this behavior and have ffmpeg to work with the data stream as it is being read?

Information needed to parse the content can be near the end of the file, as it is in this case.

> [mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [debug] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
> [mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'ftyp' parent:'root' sz: 32 8 9495632
> [mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [debug] ISO: File Type Major Brand: isom
> [mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'free' parent:'root' sz: 8 40 9495632
> [mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'mdat' parent:'root' sz: 9468817 48 9495632

At the beginning of the file, it is apparent that after 'ftyp' then 'free', 'mdat', media data, will continue for another ~9 mbytes, but that's not really useful if it can't be decoded. So rather than keep downloading, it skips to the next section of the file, looking for the necessary info.
> [mov,mp4,m4a,3gp,3g2,mj2 @ 000001faa550d080] [] type:'moov' parent:'root' sz: 26775 9468865 9495632


And 'moov' contains the info needed to make sense of the rest of the file. Now that it has that, it goes back and downloads from where it short-circuited before. At <10MBs, as you say, it might make more sense to download the whole file and then work with it on disk. But for larger downloads, or with a not-so-great connection, I'd imagine opening/closing multiple connections isn't as big a cost, resource or performance wise. And maybe more so in situations like where one might not need the video stream, for example.

-multiple_requests is supposed to keep the same connection, but I don't know if it actually works, especially depending on which ssl. If it doesn't, you can always curl or wget the whole file and avoid the extra connections' overhead, probably? Assuming that the media is self-contained in that one file, that is.
 

Regards,
Ted Park

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Ffmpeg issues multiple HTTP requests when starting a video from a URL

Vladimir Grishchenko
> And 'moov' contains the info needed to make sense of the rest of the file. Now that it has that, it goes back and downloads from where it short-circuited before. At <10MBs, as you say, it might make more sense to download the whole file and then work with it on disk. But for larger downloads, or with a not-so-great connection, I'd imagine opening/closing multiple connections isn't as big a cost, resource or performance wise. And maybe more so in situations like where one might not need the video stream, for example.

> -multiple_requests is supposed to keep the same connection, but I don't know if it actually works, especially depending on which ssl. If it doesn't, you can always curl or wget the whole file and avoid the extra connections' overhead, probably? Assuming that the media is self-contained in that one file, that is.
 
> Regards,
> Ted Park

Thanks Ted, this confirm my suspicion. Grabbing the whole file is probably not going to help much as even with a relatively small file of several Mb it will probably take about the same time initially to download it as will multiple connections that read small number of bytes. As you suspected -multiple_requests doesn't seem to help to speed things up despite the keep-alives. Fortunately this appears to be a corner case and usually ffmpeg can get going after a single connection, this likely depends on how the video file was created.

Cheers,
Vlad
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".