[FFmpeg-trac] #7710(avformat:new): pkt_size on UDP output not fixed lenght
FFmpeg
trac at avcodec.org
Thu Jan 31 19:30:13 EET 2019
#7710: pkt_size on UDP output not fixed lenght
-------------------------------------+-------------------------------------
Reporter: DVBInside | Type: defect
Status: new | Priority: normal
Component: avformat | Version: git-
Keywords: pkt_size | master
fixed length | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
When you want to output a fixed lenght of UDP packets at say 1316 bytes
(7*TS) using the UDP option pkt_size, the output is limited to 1316 bytes
but not fixed to that size.
How to reproduce:
{{{
% ffmpeg -re -i file.ts -c copy -f mpegts
udp://127.0.0.1:1234?pkt_size=1316
ffmpeg version N-93057-g860098efad Copyright (c) 2000-2019 the FFmpeg
developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --prefix=/usr
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 46.100 / 58. 46.100
libavformat 58. 26.100 / 58. 26.100
libavdevice 58. 6.101 / 58. 6.101
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100}}}
tcpdump will show this:
tcpdump -i lo0 udp port 1234
>
14:09:49.247075 IP 192.168.1.64.57226 > 127.0.0.1.1234: UDP, length 1316
14:09:49.247156 IP 192.168.1.64.57226 > 127.0.0.1.1234: UDP, length 1316
14:09:49.247314 IP 192.168.1.64.57226 > 127.0.0.1.1234: UDP, length 564
14:09:49.247490 IP 192.168.1.64.57226 > 127.0.0.1.1234: UDP, length 1316
14:09:49.247680 IP 192.168.1.64.57226 > 127.0.0.1.1234: UDP, length 1316
14:09:49.247915 IP 192.168.1.64.57226 > 127.0.0.1.1234: UDP, length 752
>
I guess this can be fixed stably just changing:
libavformat/aviobuf.c#241
>
- flush_buffer(s);
+ if (!s->max_packet_size || s->buf_ptr - s->buffer >= s-max_packet_size)
flush_buffer(s);
>
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7710>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list