Opened 4 years ago

Closed 4 years ago

#8829 closed defect (needs_more_info)

Error writing trailer of udp: Cannot allocate memory

Reported by: przemol Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: udp
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I am struggling with mapping a few mpegts inputs (spts) into 1 mpts output.
I am using ffmpeg version: 4.3.1

I am using following command to send udp data with spts transprot streams:

ffmpeg -re -stream_loop -1 -i /media/usb/MPTS.ts -map 0:p:1 -c copy -f mpegts -flush_packets 0 "udp://233.0.0.1:4000?pkt_size=1316&ttl=1&fifo_size=1000000&buffer_size=10000000" -map 0:p:2 -c copy -f mpegts -mpegts_service_id 666 -mpegts_transport_stream_id 888 -mpegts_start_pid 900  -flush_packets 0 "udp://233.0.0.1:4001?pkt_size=1316&ttl=1&fifo_size=1000000&buffer_size=10000000" -map 0:p:3 -c copy -f mpegts -flush_packets 0 "udp://233.0.0.1:4002?pkt_size=1316&ttl=1&fifo_size=1000000&buffer_size=10000000" -map 0:p:4 -c copy -f mpegts -flush_packets 0 "udp://233.0.0.1:4003?pkt_size=1316&ttl=1&fifo_size=1000000&buffer_size=10000000" -map 0:p:5 -c copy -f mpegts  -flush_packets 0 "udp://233.0.0.1:4004?pkt_size=1316&ttl=1&fifo_size=1000000&buffer_size=10000000" -map 0:p:6 -c copy -f mpegts -flush_packets 0 "udp://233.0.0.1:4005?pkt_size=1316&ttl=1&fifo_size=1000000&buffer_size=10000000"

and then I am ussing following command to make an MPTS from those input SPTS:

ffmpeg -re -thread_queue_size 256 -i "udp://233.0.0.1:4005?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4000?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4001?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4002?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4003?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4004?fifo_size=1000000&buffer_size=10000000" -map 0 -map 1 -map 2 -map 3 -map 4 -map 5 -program title=Program0:st=0:st=1 -program title=Program1:st=2:st=3 -program title=Program2:st=4:st=5 -program title=Program3:st=6:st=7 -program title=Program4:st=8:st=9 -program title=Program5:st=10:st=11 -c copy -metadata service_provider=FILE -f mpegts -muxrate 40000000 -flush_packets 0 "udp://239.2.2.2:2222?overrun_nonfatal=1&fifo_size=1000000&buffer_size=10000000&pkt_size=1316&ttl=1"

And this is working perfectly. Many hours. But there is no CBR UDP output that I need for another tool.

When I change that command and add "bitrate=40000000" to have CBR UDP utput then I have memory problem.

ffmpeg -re -thread_queue_size 256 -i "udp://233.0.0.1:4005?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4000?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4001?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4002?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4003?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4004?fifo_size=1000000&buffer_size=10000000" -map 0 -map 1 -map 2 -map 3 -map 4 -map 5 -program title=Program0:st=0:st=1 -program title=Program1:st=2:st=3 -program title=Program2:st=4:st=5 -program title=Program3:st=6:st=7 -program title=Program4:st=8:st=9 -program title=Program5:st=10:st=11 -c copy -metadata service_provider=FILE -f mpegts -muxrate 40000000 -flush_packets 0 "udp://239.2.2.2:2222?overrun_nonfatal=1&fifo_size=1000000&buffer_size=10000000&pkt_size=1316&ttl=1&bitrate=40000000"ffmpeg -re -thread_queue_size 256 -i "udp://233.0.0.1:4005?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4000?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4001?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4002?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4003?fifo_size=1000000&buffer_size=10000000" -thread_queue_size 256 -i "udp://233.0.0.1:4004?fifo_size=1000000&buffer_size=10000000" -map 0 -map 1 -map 2 -map 3 -map 4 -map 5 -program title=Program0:st=0:st=1 -program title=Program1:st=2:st=3 -program title=Program2:st=4:st=5 -program title=Program3:st=6:st=7 -program title=Program4:st=8:st=9 -program title=Program5:st=10:st=11 -c copy -metadata service_provider=FILE -f mpegts -muxrate 40000000 -flush_packets 0 "udp://239.2.2.2:2222?overrun_nonfatal=1&fifo_size=1000000&buffer_size=10000000&pkt_size=1316&ttl=1&bitrate=40000000"

After a several minutes of playing with many audio cuts, ffmpeg stops and I see:

av_interleaved_write_frame(): Cannot allocate memory
Error writing trailer of udp://239.2.2.2:2222?overrun_nonfatal=1&fifo_size=1000000&buffer_size=10000000&pkt_size=1316&ttl=1&bitrate=40000000. Cannot allocate memory

The question is: what to change in my command to have stable CBR UDP bitrate output with lack of audio cuts?

Change History (3)

comment:1 by Carl Eugen Hoyos, 4 years ago

Keywords: cbr mpegts mapping removed

Please test current FFmpeg git head and provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

comment:2 by Chris Miceli, 4 years ago

This seems to be a bit more of a usage question than a bug, you might want to try messaging the ffmpeg-user mailing list rather than post a bug here.

If you could please close this and mail that list, there will be some people to help you there.

comment:3 by Carl Eugen Hoyos, 4 years ago

Resolution: needs_more_info
Status: newclosed
Version: unspecified
Note: See TracTickets for help on using tickets.