Opened 6 years ago
Last modified 6 years ago
#7710 new defect
pkt_size on UDP output not fixed lenght
Reported by: | Antonio Jose Tomas Martinez | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avformat |
Version: | git-master | Keywords: | udp |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
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); >
Change History (4)
comment:1 by , 6 years ago
Keywords: | udp added; pkt_size fixed length removed |
---|
comment:2 by , 6 years ago
I forked it and patched on https://github.com/vidanio/FFmpeg/commit/860098efada8ea55bfb81cf1ac872c639e290580
The commandline I used it, is written above.
ffmpeg -re -i file.ts -c copy -f mpegts udp://127.0.0.1:1234?pkt_size=1316
I will try to submit it to dev mail list.
comment:3 by , 6 years ago
The only way to get a patch into FFmpeg mainline is to send it - made with git format-patch
- to the development mailing list.
If you - instead of sending a patch - want to make this a valid ticket, please add the command line you tested together with the complete, uncut console output.
comment:4 by , 6 years ago
This is not a bug. If you want fixed packet size, you should use the -flush_packets 0
option.
If you have a patch fixing this issue, please send it - attaching the result of
git format-patch
- to the FFmpeg development mailing list, patches are ignored on the bug tracker.To make this a valid bug report, please add the command line you tested together with the complete, uncut console output.