[FFmpeg-user] UDP unicast & multicast output

Isaac Asimov iasimovsp at outlook.com
Sun Jul 17 17:57:30 EEST 2016


MPEG TS unicast and multicast have exactly the same payload data in udp packets, so if unicast works fine then you can try to convert unicast to multicast with some network tool like "socat".

> From: anacelia.sarlo at gmail.com
> Date: Sat, 16 Jul 2016 19:00:31 -0300
> To: ffmpeg-user at ffmpeg.org
> Subject: Re: [FFmpeg-user] UDP unicast & multicast output
> 
> Hello, I my final environment i will be sending the multicast streaming to
> an IP QAM. But for now I'am testing both commands on my own desktop and I
> see differents bit rates, I'am attaching both outputs:
> 
> udp multicast
> 
> http://xxx.net/vxttoken=cGF0aFVSST0lMkZhdXRoXzBfYXBhNmJrN2wlMkZobHMlMkYlMkEmZXhwaXJ5PTE0Njg3MjcyNjcmcmFuZG9tPVVuQUZ1dHFpQTYmYy1pcD0xNjcuNjEuNDAuNzEsZDBkNjM5NzBhMjVmOTkxYzYwZjMyNGE3NzMzY2Q5MjE4MzAxNjE1ODYzNWZkNmYxYTMzN2VlMTY1YzNmODgxYQ==/hls/playlist.m3u8
> ffmpeg version N-79273-gd433623 Copyright (c) 2000-2016 the FFmpeg
> developers
>   built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
>   configuration: --pkg-config-flags=--static --enable-gpl --enable-nonfree
> --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame
> --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265
>   libavutil      55. 20.100 / 55. 20.100
>   libavcodec     57. 34.100 / 57. 34.100
>   libavformat    57. 31.100 / 57. 31.100
>   libavdevice    57.  0.101 / 57.  0.101
>   libavfilter     6. 41.100 /  6. 41.100
>   libswscale      4.  1.100 /  4.  1.100
>   libswresample   2.  0.101 /  2.  0.101
>   libpostproc    54.  0.100 / 54.  0.100
> [aac @ 0x3e94e00] element type mismatch 1 != 0
> [aac @ 0x3fae160] element type mismatch 1 != 0
> [aac @ 0x3f4efc0] element type mismatch 1 != 0
> [aac @ 0x40d5940] element type mismatch 1 != 0
> Input #0, hls,applehttp, from '
> http://xxxx.net./vxttoken=cGF0aFVSST0lMkZhdXRoXzBfYXBhNmJrN2wlMkZobHMlMkYlMkEmZXhwaXJ5PTE0Njg3MjcyNjcmcmFuZG9tPVVuQUZ1dHFpQTYmYy1pcD0xNjcuNjEuNDAuNzEsZDBkNjM5NzBhMjVmOTkxYzYwZjMyNGE3NzMzY2Q5MjE4MzAxNjE1ODYzNWZkNmYxYTMzN2VlMTY1YzNmODgxYQ==/hls/playlist.m3u8
> ':
>   Duration: N/A, start: 85893.692056, bitrate: N/A
>   Program 0
>     Metadata:
>       variant_bitrate : 400400
>     Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] /
> 0x001B), yuv420p, 416x234 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50
> tbc
>     Metadata:
>       variant_bitrate : 400400
>     Stream #0:1: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, fltp, 64 kb/s
>     Metadata:
>       variant_bitrate : 400400
>   Program 1
>     Metadata:
>       variant_bitrate : 950400
>     Stream #0:2: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p,
> 640x360 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
>     Metadata:
>       variant_bitrate : 950400
>     Stream #0:3: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, fltp, 72 kb/s
>     Metadata:
>       variant_bitrate : 950400
>   Program 2
>     Metadata:
>       variant_bitrate : 1390400
>     Stream #0:4: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p,
> 852x480 [SAR 1:1 DAR 71:40], 25 fps, 25 tbr, 90k tbn, 50 tbc
>     Metadata:
>       variant_bitrate : 1390400
>     Stream #0:5: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, fltp, 64 kb/s
>     Metadata:
>       variant_bitrate : 1390400
>   Program 3
>     Metadata:
>       variant_bitrate : 3440800
>     Stream #0:6: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p,
> 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
>     Metadata:
>       variant_bitrate : 3440800
>     Stream #0:7: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, fltp, 132 kb/s
>     Metadata:
>       variant_bitrate : 3440800
> Output #0, mpegts, to 'udp://224.1.1.1:1234?pkt_size=1316':
>   Metadata:
>     encoder         : Lavf57.31.100
>     Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 852x480
> [SAR 1:1 DAR 71:40], q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
>     Metadata:
>       variant_bitrate : 1390400
>     Stream #0:1: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, 64 kb/s
>     Metadata:
>       variant_bitrate : 1390400
> Stream mapping:
>   Stream #0:4 -> #0:0 (copy)
>   Stream #0:5 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> [hls,applehttp @ 0x3e76540] No longer receiving playlist 04
> bitrate=1331.5kbits/s speed=0.303x
> skipping 2 segments ahead, expired from playlists
> [hls,applehttp @ 0x3e76540] No longer receiving playlist 11
> bitrate=1391.0kbits/s speed=0.292x
> [hls,applehttp @ 0x3e76540] No longer receiving playlist 3
> ^C[hls,applehttp @ 0x3e76540] Failed to reload playlist 284 bitrate=
> 683.8kbits/s speed=0.608x
> av_interleaved_write_frame(): Immediate exit requested
> Error writing trailer of udp://224.1.1.1:1234?pkt_size=1316: Immediate exit
> requestedframe=  599 fps=7.3 q=-1.0 Lsize=    4080kB time=00:00:48.01
> bitrate= 696.1kbits/s speed=0.582x
> video:3529kB audio:188kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 9.758626%
> Exiting normally, received signal 2.
> 
> Then the same command, but with udp unicast:
> 
> http://xxxx.net//wstoken=cGF0aFVSST0lMkZhdXRoXzBfYXBhNmJrN2wlMkZobHMlMkYlMkEmZXhwaXJ5PTE0Njg3Mjc2NTUmcmFuZG9tPW1LdUhnSlNMc1YmYy1pcD0xNjcuNjEuNDAuNzEsYTNmM2ZjNTc3ZmU4ODk1ZWE2NTQ0NGM0NGE2YTEyMmY4YzQ2MGE0YjljMDMxNDNmNjQ0N2ZiYmFlMTBlMThmZA==/hls/playlist.m3u8
> ffmpeg version N-79273-gd433623 Copyright (c) 2000-2016 the FFmpeg
> developers
>   built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
>   configuration: --pkg-config-flags=--static --enable-gpl --enable-nonfree
> --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame
> --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265
>   libavutil      55. 20.100 / 55. 20.100
>   libavcodec     57. 34.100 / 57. 34.100
>   libavformat    57. 31.100 / 57. 31.100
>   libavdevice    57.  0.101 / 57.  0.101
>   libavfilter     6. 41.100 /  6. 41.100
>   libswscale      4.  1.100 /  4.  1.100
>   libswresample   2.  0.101 /  2.  0.101
>   libpostproc    54.  0.100 / 54.  0.100
> [aac @ 0x2e3ae00] element type mismatch 1 != 0
> [aac @ 0x2f3e220] element type mismatch 1 != 0
> [aac @ 0x2efa440] element type mismatch 1 != 0
> [aac @ 0x2eec840] element type mismatch 1 != 0
> Input #0, hls,applehttp, from '
> http://xxxx.net/vxttoken=cGF0aFVSST0lMkZhdXRoXzBfYXBhNmJrN2wlMkZobHMlMkYlMkEmZXhwaXJ5PTE0Njg3Mjc2NTUmcmFuZG9tPW1LdUhnSlNMc1YmYy1pcD0xNjcuNjEuNDAuNzEsYTNmM2ZjNTc3ZmU4ODk1ZWE2NTQ0NGM0NGE2YTEyMmY4YzQ2MGE0YjljMDMxNDNmNjQ0N2ZiYmFlMTBlMThmZA==/hls/playlist.m3u8
> ':
>   Duration: N/A, start: 86277.692056, bitrate: N/A
>   Program 0
>     Metadata:
>       variant_bitrate : 400400
>     Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] /
> 0x001B), yuv420p, 416x234 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50
> tbc
>     Metadata:
>       variant_bitrate : 400400
>     Stream #0:1: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, fltp, 68 kb/s
>     Metadata:
>       variant_bitrate : 400400
>   Program 1
>     Metadata:
>       variant_bitrate : 950400
>     Stream #0:2: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p,
> 640x360 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
>     Metadata:
>       variant_bitrate : 950400
>     Stream #0:3: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, fltp, 66 kb/s
>     Metadata:
>       variant_bitrate : 950400
>   Program 2
>     Metadata:
>       variant_bitrate : 1390400
>     Stream #0:4: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p,
> 852x480 [SAR 1:1 DAR 71:40], 25 fps, 25 tbr, 90k tbn, 50 tbc
>     Metadata:
>       variant_bitrate : 1390400
>     Stream #0:5: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, fltp, 68 kb/s
>     Metadata:
>       variant_bitrate : 1390400
>   Program 3
>     Metadata:
>       variant_bitrate : 3440800
>     Stream #0:6: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p,
> 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
>     Metadata:
>       variant_bitrate : 3440800
>     Stream #0:7: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, fltp, 130 kb/s
>     Metadata:
>       variant_bitrate : 3440800
> Output #0, mpegts, to 'udp://192.168.1.109:1234?pkt_size=1316':
>   Metadata:
>     encoder         : Lavf57.31.100
>     Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 852x480
> [SAR 1:1 DAR 71:40], q=2-31, 25 fps, 25 tbr, 90k tbn, 90k tbc
>     Metadata:
>       variant_bitrate : 1390400
>     Stream #0:1: Audio: aac (HE-AAC) ([15][0][0][0] / 0x000F), 44100 Hz,
> stereo, 68 kb/s
>     Metadata:
>       variant_bitrate : 1390400
> Stream mapping:
>   Stream #0:4 -> #0:0 (copy)
>   Stream #0:5 -> #0:1 (copy)
> Press [q] to stop, [?] for help
> [hls,applehttp @ 0x2e1c540] No longer receiving playlist 04
> bitrate=1244.4kbits/s speed=   1x
> [hls,applehttp @ 0x2e1c540] No longer receiving playlist 1
> [hls,applehttp @ 0x2e1c540] No longer receiving playlist 33
> bitrate=1384.6kbits/s speed=0.984x
> frame= 1720 fps= 25 q=-1.0 Lsize=   11693kB time=00:01:08.72
> bitrate=1394.0kbits/s speed=   1x
> video:10129kB audio:528kB subtitle:0kB other streams:0kB global headers:0kB
> muxing overhead: 9.723038%
> Exiting normally, received signal 2.
> 
> 
> And when I do the same test to the IP QAM multicast address I have the same
> result. It seems it's related to the form ffmpeg works with udp.
> 
> Thanks for your help!
> 
> On Sat, Jul 16, 2016 at 5:57 PM, pkv.stream <pkv.stream at gmail.com> wrote:
> 
> > well, the port 1234 is closed on your 224,1,1,1 address ...
> > (I jsut scanned it)
> >
> >
> > Le 16/07/2016 à 9:40 PM, Anacelia Sarlo a écrit :
> >
> >> Hello,
> >>        I'am receiving a live stream and I want to copy 2 bit streams
> >> (video
> >> H.264 & audio AAC)  and re stream them with mpegts format to an udp
> >> multicast output.
> >> With an udp unicast output it works ok, but when I try with an udp
> >> multicast one, I see the on the ffmpeg console that the rate start to down
> >> and the stream begin
> >> to cut off.
> >> My doubt is how ffmpeg works with udp unicast and multicast, and what
> >> could
> >> be wrong with my  multicast example?
> >> I'am attaching both commands.
> >>
> >> UDP unicast output
> >> ffmpeg -re -y -i $stream -map 0:4 -map 0:5 -rtbufsize 1G -c copy -f mpegts
> >> -mpegts_pmt_start_pid 66 -streamid 1:71 -streamid 0:70 udp://
> >> 192.168.1.109:1234?pkt_size=1316  works OK!
> >>
> >> UDP multicast output
> >> ffmpeg -re -y -i $stream -map 0:4 -map 0:5 -rtbufsize 1G -c copy -f mpegts
> >> -mpegts_pmt_start_pid 66 -streamid 1:71 -streamid 0:70 udp://
> >> 224.1.1.1:1234?pkt_size=1316 video cut off!
> >>
> >> Thanks a lot for your suggestions.
> >> Ana
> >> _______________________________________________
> >> ffmpeg-user mailing list
> >> ffmpeg-user at ffmpeg.org
> >> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >>
> >> To unsubscribe, visit link above, or email
> >> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> >>
> >
> >
> > _______________________________________________
> > ffmpeg-user mailing list
> > ffmpeg-user at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
 		 	   		  


More information about the ffmpeg-user mailing list