[FFmpeg-devel] [patch][RFC] mpeg-ts not packetized properly over UDP

Alexandre Ferrieux alexandre.ferrieux
Thu Aug 26 14:32:46 CEST 2010


On 26/08/2010 14:25, atv_ffmpeg wrote:
> Just modify udp.c in the folder called libavformat, change 1472 to 1316,
> function 'udp_open'. It works fine. I already did it.


1) Don't top post.

2) Of course it works. But hard-coding the TS-specific magic number 7*188 in place of the generic, MTU-related 1472 in 
the muxer+codec-agnostic module udp.c, while a command-line override does it, is a bad idea.

Maybe some kind of information could flow from the TS container to the UDP url handler, to set it automatically ? Not 
familiar enough with that part though. The command-line override is perfect in the meanime.

-Alex


>
> 2010/8/15 aviad rozenhek<aviadr1 at gmail.com>
>
>> when using ffmpeg to mux an mpegts stream over UDP, the data is not
>> packetized properly.
>> the default packet size of UDP is 1472, which is not an integer multiple of
>> 188 (the TS packet size).
>> this causes problems if UDP packets are dropped or reordered.
>>
>> this can be worked around from the commandline if changing  cmdline from:
>> *>  ffmpeg -re -i<input_file>   -f mpegts udp://localhost:1234*
>> to:
>> *>  ffmpeg -re -i<input_file>   -f mpegts udp://localhost:1234?pkt_size=188*
>> *
>> *
>> however I think this makes it difficult for user to use properly.
>> attached is a simple (but not as efficient as possible) patch that fixes
>> this problem, by flushing after writing every TS packet.
>>
>> --
>> Aviad Rozenhek
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at mplayerhq.hu
>> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>




More information about the ffmpeg-devel mailing list