rheala / lavfilters

Automatically exported from code.google.com/p/lavfilters
GNU General Public License v2.0
0 stars 0 forks source link

UDP Multicast MPEG2-TS stream takes a long time (about 7 seconds) to start playing #368

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Describe the issue you're having:
Open an UDP multicast MPEG2-TS stream with LAVSplitter takes about 7 seconds.
Have narrowed down the problem to analyzeduration parameter/setting of ffmpeg.
See this post on doom9: 
http://forum.doom9.org/showthread.php?p=1625617&highlight=debug#post1625617

Its the function call "avformat_find_stream_info" of LAVSplitter to ffmpeg 
which takes such a long time.
Here is a debug log entry of LAVSplitter:

LAVSplitter.ax(tid 8fc)    13356 : ::InitAVFormat(): avformat_find_stream_info 
finished, took 6 seconds

After reading and googling it seems that avformat_find_stream_info analyzes the 
input/stream for the configured period of time "analyzeduration".

The current value of analyzeduration is in file 
\ffmpeg\libavformat\options_table.h on line 52.
Its value is: 5 x AV_TIME_BASE = 5 x 1000000µs = 5 seconds

For test purposes i have changed the value to AV_TIME_BASE / 2 = 1000000µs / 2 
= 0,5 seconds.
And now its a lot faster.

What do you think about this?
Do you have any suggestions whats the best value?
Could you change this in master tree source?

How can the issue be reproduced? Sample File?
Here you could download the sample & batchfile incl. VLC 2.0.6: 
http://www23.zippyshare.com/v/47895257/file.html

Steps to setup the test stream:

 1. Extract ZIP
 2. Start "play-multicast-with-vlc.bat" -> VLC should open and streams out an multicast to udp 224.1.1.1

Steps to reproduce the issue:
 1. Open graphedit
 2. Press New Button in toolbar
 3. Load the supplied "graph.grf" Graph File
 4. Now it takes the time (6 seconds) like mentioned above to show the graph (function avformat_find_stream_info)

(to reproduce it again just start from step 2. (Press New....))

What version of the product are you using? In which Player?
LAVFilters-0.58-pthreads
graphstudionext_0_5_1_117
VLC 2.06 (see ZIP file above)

Please provide any additional information below.
Attached is the patched avformat dll compiled with pthreads.
This dll has set the analyzeduration to 0,5 secs
When you use this file, then the stream opens a lot faster!

thx
Tobias

Original issue reported on code.google.com by Tobias.D...@gmail.com on 25 Jun 2013 at 1:16

Attachments:

GoogleCodeExporter commented 9 years ago
A longer analyzeduration ensures that everything is properly detected in some 
"broken" or badly-formed files. So generally lowering it may not be a good 
option.

However, it might be possible to check if we're dealing with a stream and/or a 
network protocol, and then lower the value for improved streaming behaviour, 
because on files its really quite different.

I'll look into it.

Original comment by h.lepp...@gmail.com on 25 Jun 2013 at 1:24

GoogleCodeExporter commented 9 years ago
Thats a good idea!
Looking forward to your test versions :-)

Original comment by Tobias.D...@gmail.com on 25 Jun 2013 at 1:48

GoogleCodeExporter commented 9 years ago
I went with 1s probe duration for now, which is already much better than the 5s 
before, but i'm thinking about making the two values (or at least the one for 
the network streams) configurable, so the user can configure if he wants faster 
playback or more reliable stream detection.

Original comment by h.lepp...@gmail.com on 30 Jun 2013 at 12:58

GoogleCodeExporter commented 9 years ago
Thank you for this change.
I also think making it configurable is an good solution.
Like in my test version 500ms works very good for MPEG2TS multicast streams.

Tobias

Original comment by Tobias.D...@gmail.com on 1 Jul 2013 at 6:17

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 2ad572ed12a6.

Original comment by h.lepp...@gmail.com on 3 Jul 2013 at 6:17