Re: [FFmpeg-devel] [PATCH] hls: call avformat_find_stream_info for mpegts subdemuxer

2016-11-10 Thread Hendrik Leppkes
On Thu, Nov 10, 2016 at 12:38 PM, wm4  wrote:
> On Thu, 3 Nov 2016 01:12:03 +0100
> Andreas Cadhalpun  wrote:
>
>> This fixes probing dts/eac3/mp2 in hls.
>>
>> The problem was introduced in commit 
>> 04964ac311abe670fb3b60290a330f2067544b13.
>>
>> Also update the fate reference for the fate-segment-mp4-to-ts test.
>>
>> Signed-off-by: Andreas Cadhalpun 
>> ---
>>
>> I've no idea why the fate reference changes, but this also happens when
>> partially/fully reverting commit 04964ac311abe670fb3b60290a330f2067544b13.
>> And it's a very recent fate test...
>>
>> ---
>
> Will this make segment switch latencies even worse? The HLS demuxer is
> already terrible for realtime playback because it closes and reopens
> the TCP connection on each segment.
>

An alternative patch was applied that doesn't use double-probing
(hence the slowdown issue was brought up in this thread), but even in
this approach it would only probe at startup once, and not every
segment.

- Hendrik
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] hls: call avformat_find_stream_info for mpegts subdemuxer

2016-11-10 Thread wm4
On Thu, 3 Nov 2016 01:12:03 +0100
Andreas Cadhalpun  wrote:

> This fixes probing dts/eac3/mp2 in hls.
> 
> The problem was introduced in commit 04964ac311abe670fb3b60290a330f2067544b13.
> 
> Also update the fate reference for the fate-segment-mp4-to-ts test.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
> 
> I've no idea why the fate reference changes, but this also happens when
> partially/fully reverting commit 04964ac311abe670fb3b60290a330f2067544b13.
> And it's a very recent fate test...
> 
> ---

Will this make segment switch latencies even worse? The HLS demuxer is
already terrible for realtime playback because it closes and reopens
the TCP connection on each segment.

(Didn't check whether this is already applied.)
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] hls: call avformat_find_stream_info for mpegts subdemuxer

2016-11-05 Thread Anssi Hannula
03.11.2016, 20:34, Andreas Cadhalpun kirjoitti:
> On 03.11.2016 11:18, Anssi Hannula wrote:
>> Andreas Cadhalpun kirjoitti 2016-11-03 02:12:
>>> This fixes probing dts/eac3/mp2 in hls.
>>>
>>> The problem was introduced in commit 
>>> 04964ac311abe670fb3b60290a330f2067544b13.
>>>
>>> Also update the fate reference for the fate-segment-mp4-to-ts test.
>>
>> Thanks.
>>
>> Can you point me to some example streams with this issue? (or how to 
>> generate one)
> 
> ffmpeg creates these, as I've mentioned in [1], e.g.:
> $ ./ffmpeg -f lavfi -i sine=d=0.1 -strict -2 -c:a dca -f hls dca.hls -y &> 
> /dev/null
> $ ./ffmpeg -f lavfi -i sine=d=0.1 -strict -2 -c:a eac3 -f hls eac3.hls -y &> 
> /dev/null
> $ ./ffmpeg -f lavfi -i sine=d=0.1 -strict -2 -c:a mp2 -f hls mp2.hls -y &> 
> /dev/null
> 
> Then run ffprobe on the created hls files to see the problems.
> 
>> Unfortunately calling avformat_find_stream_info() for sub-mpegts streams is 
>> quite
>> bandwidth-heavy (especially if there are many stream variants and/or 
>> alternative
>> renditions, and especially now that we no longer clear mpegts 
>> AVFMTCTX_NOHEADER
>> flag so that streams like #4930 work) so I tried to avoid that.
>> It is better than doing nothing, though, if we can't find an alternative 
>> solution
>> (better slow than not working).
>>
>> I'd first like to try to understand what is happening, though.
> 
> OK. A better solution is always welcome.

Thanks for the examples.

The two follow-up patches fix them for me, can you confirm and/or see anything 
else?


Anssi Hannula (2):
  avformat/hls: Factor copying stream info to a separate function
  avformat/hls: Fix probing mpegts audio streams that use probing

-- 
Anssi Hannula

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] hls: call avformat_find_stream_info for mpegts subdemuxer

2016-11-03 Thread Andreas Cadhalpun
Hi,

On 03.11.2016 11:18, Anssi Hannula wrote:
> Andreas Cadhalpun kirjoitti 2016-11-03 02:12:
>> This fixes probing dts/eac3/mp2 in hls.
>>
>> The problem was introduced in commit 
>> 04964ac311abe670fb3b60290a330f2067544b13.
>>
>> Also update the fate reference for the fate-segment-mp4-to-ts test.
> 
> Thanks.
> 
> Can you point me to some example streams with this issue? (or how to generate 
> one)

ffmpeg creates these, as I've mentioned in [1], e.g.:
$ ./ffmpeg -f lavfi -i sine=d=0.1 -strict -2 -c:a dca -f hls dca.hls -y &> 
/dev/null
$ ./ffmpeg -f lavfi -i sine=d=0.1 -strict -2 -c:a eac3 -f hls eac3.hls -y &> 
/dev/null
$ ./ffmpeg -f lavfi -i sine=d=0.1 -strict -2 -c:a mp2 -f hls mp2.hls -y &> 
/dev/null

Then run ffprobe on the created hls files to see the problems.

> Unfortunately calling avformat_find_stream_info() for sub-mpegts streams is 
> quite
> bandwidth-heavy (especially if there are many stream variants and/or 
> alternative
> renditions, and especially now that we no longer clear mpegts 
> AVFMTCTX_NOHEADER
> flag so that streams like #4930 work) so I tried to avoid that.
> It is better than doing nothing, though, if we can't find an alternative 
> solution
> (better slow than not working).
> 
> I'd first like to try to understand what is happening, though.

OK. A better solution is always welcome.

Best regards,
Andreas

1: https://ffmpeg.org/pipermail/ffmpeg-devel/2016-October/201870.html

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] hls: call avformat_find_stream_info for mpegts subdemuxer

2016-11-03 Thread Anssi Hannula

Hi,

Andreas Cadhalpun kirjoitti 2016-11-03 02:12:

This fixes probing dts/eac3/mp2 in hls.

The problem was introduced in commit 
04964ac311abe670fb3b60290a330f2067544b13.


Also update the fate reference for the fate-segment-mp4-to-ts test.


Thanks.

Can you point me to some example streams with this issue? (or how to 
generate one)


Unfortunately calling avformat_find_stream_info() for sub-mpegts streams 
is quite bandwidth-heavy (especially if there are many stream variants 
and/or alternative renditions, and especially now that we no longer 
clear mpegts AVFMTCTX_NOHEADER flag so that streams like #4930 work) so 
I tried to avoid that.
It is better than doing nothing, though, if we can't find an alternative 
solution (better slow than not working).


I'd first like to try to understand what is happening, though.




Signed-off-by: Andreas Cadhalpun 
---

I've no idea why the fate reference changes, but this also happens when
partially/fully reverting commit 
04964ac311abe670fb3b60290a330f2067544b13.

And it's a very recent fate test...

---
 libavformat/hls.c|  2 +-
 tests/ref/fate/segment-mp4-to-ts | 77 
+---

 2 files changed, 50 insertions(+), 29 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 3c09dd8..543e65c 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1756,7 +1756,7 @@ static int hls_read_header(AVFormatContext *s)
  * but for other streams we can rely on our user calling
avformat_find_stream_info()
  * on us if they want to.
  */
-if (pls->is_id3_timestamped) {
+if (pls->is_id3_timestamped || av_match_name(in_fmt->name, 
"mpegts")) {

 ret = avformat_find_stream_info(pls->ctx, NULL);
 if (ret < 0)
 goto fail;
diff --git a/tests/ref/fate/segment-mp4-to-ts 
b/tests/ref/fate/segment-mp4-to-ts

index 8513027..acb1199 100644
--- a/tests/ref/fate/segment-mp4-to-ts
+++ b/tests/ref/fate/segment-mp4-to-ts
@@ -5,34 +5,55 @@
 #dimensions 0: 640x360
 #sar 0: 1/1
 0,  -7200,  0,0,22630, 0x9b109541, S=1,
 1, 0x00e000e0
-0,  -3600,  14400,0, 4021, 0xbf7cdb02, F=0x0,
S=1,1, 0x00e000e0
-0,  0,   7200,0, 1096, 0x4f162690, F=0x0,
S=1,1, 0x00e000e0
-0,   3600,   3600,0,  687, 0x00394b95, F=0x0,
S=1,1, 0x00e000e0
-0,   7200,  10800,0,  445, 0x08c3d065, F=0x0,
S=1,1, 0x00e000e0
-0,  10800,  28800,0, 4212, 0x56d12b8f, F=0x0,
S=1,1, 0x00e000e0
-0,  14400,  21600,0, 1117, 0xd521260b, F=0x0,
S=1,1, 0x00e000e0
-0,  18000,  18000,0,  892, 0x4262bdbc, F=0x0,
S=1,1, 0x00e000e0
-0,  21600,  25200,0,  480, 0x3be1ef0b, F=0x0,
S=1,1, 0x00e000e0
-0,  25200,  43200,0, 4065, 0x40dee237, F=0x0,
S=1,1, 0x00e000e0
-0,  28800,  36000,0,  962, 0x31a4ceb1, F=0x0,
S=1,1, 0x00e000e0
-0,  32400,  32400,0,  651, 0xb2aa317a, F=0x0,
S=1,1, 0x00e000e0
-0,  36000,  39600,0,  543, 0x9c4e0024, F=0x0,
S=1,1, 0x00e000e0
-0,  39600,  57600,0, 4221, 0x77c23977, F=0x0,
S=1,1, 0x00e000e0
-0,  43200,  50400,0, 1040, 0x482cfa34, F=0x0,
S=1,1, 0x00e000e0
-0,  46800,  46800,0,  576, 0x2686136a, F=0x0,
S=1,1, 0x00e000e0
-0,  50400,  54000,0,  607, 0xc53c2339, F=0x0,
S=1,1, 0x00e000e0
-0,  54000,  72000,0, 4755, 0x2f642b58, F=0x0,
S=1,1, 0x00e000e0
-0,  57600,  64800,0, 1182, 0xbe1a4847, F=0x0,
S=1,1, 0x00e000e0
-0,  61200,  61200,0,  809, 0x8d948a4e, F=0x0,
S=1,1, 0x00e000e0
-0,  64800,  68400,0,  656, 0x4fa03c2b, F=0x0,
S=1,1, 0x00e000e0
-0,  68400,  86400,0,26555, 0x5629b584, S=1,
 1, 0x00e000e0
-0,  72000,  79200,0, 1141, 0x761b31e8, F=0x0,
S=1,1, 0x00e000e0
-0,  75600,  75600,0,  717, 0x57746351, F=0x0,
S=1,1, 0x00e000e0
-0,  79200,  82800,0,  693, 0x78b24263, F=0x0,
S=1,1, 0x00e000e0
-0,  82800, 100800,0, 3417, 0x560dbc89, F=0x0,
S=1,1, 0x00e000e0
-0,  86400,  93600,0, 1128, 0xc0f1383c, F=0x0,
S=1,1, 0x00e000e0
-0,  9,  9,0,  650, 0xc3ad485e, F=0x0,
S=1,1, 0x00e000e0
-0,  93600,  97200,0,  766, 0xd3e9757d, F=0x0,
S=1,1, 0x00e000e0
+0,  -3600,  14400, 3600, 4021, 0xbf7cdb02, F=0x0,
S=1,1, 0x00e000e0
+0,  0,   7200, 3600, 1096, 0x4f162690, F=0x0,
S=1,1, 0x00e000e0
+0,   3600,   3600, 3600,  687, 0x00394b95, F=0x0,
S=1,

Re: [FFmpeg-devel] [PATCH] hls: call avformat_find_stream_info for mpegts subdemuxer

2016-11-03 Thread Michael Niedermayer
On Thu, Nov 03, 2016 at 01:12:03AM +0100, Andreas Cadhalpun wrote:
> This fixes probing dts/eac3/mp2 in hls.
> 
> The problem was introduced in commit 04964ac311abe670fb3b60290a330f2067544b13.
> 
> Also update the fate reference for the fate-segment-mp4-to-ts test.
> 
> Signed-off-by: Andreas Cadhalpun 
> ---
> 
> I've no idea why the fate reference changes, but this also happens when
> partially/fully reverting commit 04964ac311abe670fb3b60290a330f2067544b13.
> And it's a very recent fate test...
>
> ---
>  libavformat/hls.c|  2 +-
>  tests/ref/fate/segment-mp4-to-ts | 77 
> +---
>  2 files changed, 50 insertions(+), 29 deletions(-)

CCing anssi as the referenced commit is from him

[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] hls: call avformat_find_stream_info for mpegts subdemuxer

2016-11-02 Thread Andreas Cadhalpun
This fixes probing dts/eac3/mp2 in hls.

The problem was introduced in commit 04964ac311abe670fb3b60290a330f2067544b13.

Also update the fate reference for the fate-segment-mp4-to-ts test.

Signed-off-by: Andreas Cadhalpun 
---

I've no idea why the fate reference changes, but this also happens when
partially/fully reverting commit 04964ac311abe670fb3b60290a330f2067544b13.
And it's a very recent fate test...

---
 libavformat/hls.c|  2 +-
 tests/ref/fate/segment-mp4-to-ts | 77 +---
 2 files changed, 50 insertions(+), 29 deletions(-)

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 3c09dd8..543e65c 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -1756,7 +1756,7 @@ static int hls_read_header(AVFormatContext *s)
  * but for other streams we can rely on our user calling 
avformat_find_stream_info()
  * on us if they want to.
  */
-if (pls->is_id3_timestamped) {
+if (pls->is_id3_timestamped || av_match_name(in_fmt->name, "mpegts")) {
 ret = avformat_find_stream_info(pls->ctx, NULL);
 if (ret < 0)
 goto fail;
diff --git a/tests/ref/fate/segment-mp4-to-ts b/tests/ref/fate/segment-mp4-to-ts
index 8513027..acb1199 100644
--- a/tests/ref/fate/segment-mp4-to-ts
+++ b/tests/ref/fate/segment-mp4-to-ts
@@ -5,34 +5,55 @@
 #dimensions 0: 640x360
 #sar 0: 1/1
 0,  -7200,  0,0,22630, 0x9b109541, S=1,1, 
0x00e000e0
-0,  -3600,  14400,0, 4021, 0xbf7cdb02, F=0x0, S=1,
1, 0x00e000e0
-0,  0,   7200,0, 1096, 0x4f162690, F=0x0, S=1,
1, 0x00e000e0
-0,   3600,   3600,0,  687, 0x00394b95, F=0x0, S=1,
1, 0x00e000e0
-0,   7200,  10800,0,  445, 0x08c3d065, F=0x0, S=1,
1, 0x00e000e0
-0,  10800,  28800,0, 4212, 0x56d12b8f, F=0x0, S=1,
1, 0x00e000e0
-0,  14400,  21600,0, 1117, 0xd521260b, F=0x0, S=1,
1, 0x00e000e0
-0,  18000,  18000,0,  892, 0x4262bdbc, F=0x0, S=1,
1, 0x00e000e0
-0,  21600,  25200,0,  480, 0x3be1ef0b, F=0x0, S=1,
1, 0x00e000e0
-0,  25200,  43200,0, 4065, 0x40dee237, F=0x0, S=1,
1, 0x00e000e0
-0,  28800,  36000,0,  962, 0x31a4ceb1, F=0x0, S=1,
1, 0x00e000e0
-0,  32400,  32400,0,  651, 0xb2aa317a, F=0x0, S=1,
1, 0x00e000e0
-0,  36000,  39600,0,  543, 0x9c4e0024, F=0x0, S=1,
1, 0x00e000e0
-0,  39600,  57600,0, 4221, 0x77c23977, F=0x0, S=1,
1, 0x00e000e0
-0,  43200,  50400,0, 1040, 0x482cfa34, F=0x0, S=1,
1, 0x00e000e0
-0,  46800,  46800,0,  576, 0x2686136a, F=0x0, S=1,
1, 0x00e000e0
-0,  50400,  54000,0,  607, 0xc53c2339, F=0x0, S=1,
1, 0x00e000e0
-0,  54000,  72000,0, 4755, 0x2f642b58, F=0x0, S=1,
1, 0x00e000e0
-0,  57600,  64800,0, 1182, 0xbe1a4847, F=0x0, S=1,
1, 0x00e000e0
-0,  61200,  61200,0,  809, 0x8d948a4e, F=0x0, S=1,
1, 0x00e000e0
-0,  64800,  68400,0,  656, 0x4fa03c2b, F=0x0, S=1,
1, 0x00e000e0
-0,  68400,  86400,0,26555, 0x5629b584, S=1,1, 
0x00e000e0
-0,  72000,  79200,0, 1141, 0x761b31e8, F=0x0, S=1,
1, 0x00e000e0
-0,  75600,  75600,0,  717, 0x57746351, F=0x0, S=1,
1, 0x00e000e0
-0,  79200,  82800,0,  693, 0x78b24263, F=0x0, S=1,
1, 0x00e000e0
-0,  82800, 100800,0, 3417, 0x560dbc89, F=0x0, S=1,
1, 0x00e000e0
-0,  86400,  93600,0, 1128, 0xc0f1383c, F=0x0, S=1,
1, 0x00e000e0
-0,  9,  9,0,  650, 0xc3ad485e, F=0x0, S=1,
1, 0x00e000e0
-0,  93600,  97200,0,  766, 0xd3e9757d, F=0x0, S=1,
1, 0x00e000e0
+0,  -3600,  14400, 3600, 4021, 0xbf7cdb02, F=0x0, S=1,
1, 0x00e000e0
+0,  0,   7200, 3600, 1096, 0x4f162690, F=0x0, S=1,
1, 0x00e000e0
+0,   3600,   3600, 3600,  687, 0x00394b95, F=0x0, S=1,
1, 0x00e000e0
+0,   7200,  10800, 3600,  445, 0x08c3d065, F=0x0, S=1,
1, 0x00e000e0
+0,  10800,  28800, 3600, 4212, 0x56d12b8f, F=0x0, S=1,
1, 0x00e000e0
+0,  14400,  21600, 3600, 1117, 0xd521260b, F=0x0, S=1,
1, 0x00e000e0
+0,  18000,  18000, 3600,  892, 0x4262bdbc, F=0x0, S=1,
1, 0x00e000e0
+0,  21600,  25200, 3600,  480, 0x3be1ef0b, F=0x0, S=1,
1, 0x00e000e0
+0,  25200,  43200, 3600, 4065, 0x40dee237, F=0x0, S=1,
1, 0x00e000e0
+0,  28800,  36000,