[FFmpeg-devel] mpeg TS encoder PCR algo + looping
Michael Niedermayer
michael at niedermayer.cc
Tue Mar 28 23:13:52 EEST 2017
On Tue, Mar 28, 2017 at 06:30:30PM +0300, ffmpeg at scil.sinp.msu.ru wrote:
>
> Hi!
>
> Attached patch changes the PCR pid dedication number algo:
> pcr_pid belongs to the program, not to entire TS (it was the mistake
> in TS code). So, the patch makes it possible to broadcast TS with
> several programs inside.
> It is possible to set the pcr pid manually by adding in the prog
> conf like this (pcr_pid=0x301):
> -program title="Xren2":service_provider="provider5":program_num=0x5579:pcr_pid=0x301:st=0
> Not tested: multiple TS streaming.
>
> Also, the title, service name and provider name were corrected in
> the ffmpeg_opt.c: options required in mpegtsenc.c were not present
> in ffmpeg_opt from the genesis, and the only provider was ffmpeg.
> Look at example above (service_provider="provider5").
>
> Behaviour of "-stream_loop" and "-re" options changes with this patch:
> ffmpeg -re \
> -i auu.wav \
> -re \
> -stream_loop 4 \
> -re \
> -i auu1.wav \
>
> will loop 4 times auu1.wav, while auu.wav forever. So, the streaming
> continues while one prog is finished. Touches all containers.
>
> Example 1 (streaming 4 progs in one mpeg TS):
> ffmpeg -re \
> -i bbbbb_800x450_25fps.avi \
> -i xxxxx.wav \
> -i yyyyy.wav -stream_loop 10\
> -i zzzz.mp3 \
> -map 0:v \
> -map 0:a \
> -map_channel 0.1.0:1.0 \
> -map_channel 0.1.1:1.1 \
> -vcodec libx264 -b:v 800k \
> -x264-params level=30:bframes=5:weightp=0:\
> cabac=0:ref=1:vbv-maxrate=560:vbv-bufsize=2000:analyse=all:me=umh:\
> no-fast-pskip=1:subq=6:8x8dct=0:trellis=0 \
> -mpegts_original_network_id 0x1122 \
> -mpegts_transport_stream_id 0x3344 \
> -mpegts_service_id 0x5566 \
> -streamid 0:0x159 \
> -metadata service_provider="Some provider" \
> -metadata service_name="Some Channel" \
> -c:a:0 libfdk_aac -profile:a aac_he -ac 2 -b:a 32k \
> -streamid 1:0x160 \
> -f mpegts \
> -map 1:a \
> -mpegts_original_network_id 0x1123 \
> -mpegts_transport_stream_id 0x3345 \
> -mpegts_service_id 0x55CA \
> -metadata service_provider="Some provider1" \
> -metadata service_name="Some Channel1" \
> -map_channel 1.0.0:2.0 \
> -map_channel 1.0.1:2.1 \
> -c:a:1 libfdk_aac -profile:a aac_he_v2 -ac 2 -b:a 32k \
> -streamid 2:0x180 \
> -f mpegts \
> -map 2:a \
> -mpegts_original_network_id 0x1127 \
> -mpegts_transport_stream_id 0x3348 \
> -mpegts_service_id 0x55CE \
> -map_channel 2.0.0:3.0 \
> -map_channel 2.0.1:3.1 \
> -c:a:2 libfdk_aac -profile:a aac_he_v2 -ac 2 -b:a 32k \
> -streamid 3:0x182 \
> -map 3:a \
> -mpegts_original_network_id 0x1129 \
> -mpegts_transport_stream_id 0x3349 \
> -mpegts_service_id 0x55CF \
> -map_channel 3.0.0:4.0 \
> -map_channel 3.0.1:4.1 \
> -c:a:3 libfdk_aac -profile:a aac_he_v2 -ac 2 -b:a 32k \
> -streamid 4:0x184 \
> -program title="Xren0":service_name="Zanunda":service_provider="provider4":program_num=0x5576:st=0:st=1
> \
> -program title="Xren1":service_provider="provider4":program_num=0x5578:st=2 \
> -program title="Xren2":service_provider="provider5":program_num=0x5579:st=3 \
> -program title="Xren3":service_provider="provider6":program_num=0x5581:st=4 \
> -metadata service_provider="Some provider3" \
> -metadata service_name="Some Channel3" \
> -f mpegts udp://172.16.1.10:1234\&pkt_size=1316
>
> Example 2 (streaming 2 audio files with looping/repeat; note, to
> repeat, use -re for required input stream; 1 mpeg TS out):
> ffmpeg -re \
> -i auu.wav \
> -re \
> -stream_loop 4 \
> -re \
> -i auu.wav \
> -map 0:a \
> -mpegts_original_network_id 0x1127 \
> -mpegts_transport_stream_id 0x3348 \
> -mpegts_service_id 0x55CE \
> -map_channel 0.0.0:0.0 \
> -map_channel 0.0.1:0.1 \
> -c:a:0 libfdk_aac -profile:a aac_he_v2 -ac 2 -b:a 32k \
> -streamid 0:0x182 \
> -map 1:a \
> -mpegts_original_network_id 0x1129 \
> -mpegts_transport_stream_id 0x3349 \
> -mpegts_service_id 0x55CF \
> -map_channel 1.0.0:1.0 \
> -map_channel 1.0.1:1.1 \
> -c:a:1 libfdk_aac -profile:a aac_he_v2 -ac 2 -b:a 32k \
> -streamid 1:0x184 \
> -program title="Xren2":service_provider="provider5":program_num=0x5579:st=0 \
> -program title="Xren3":service_provider="provider6":program_num=0x5581:st=1 \
> -metadata service_provider="Some provider3" \
> -metadata service_name="Some Channel3" \
> -f mpegts udp://172.16.1.10:1234\&pkt_size=1316
> ffmpeg.c | 26 +++++++++
> ffmpeg_opt.c | 7 !!
> ffmpeg_orig.c |only
> ffmpeg_vvs.c |only
> libavformat/mpegtsenc.c | 126 +++++++++++++++++++++++++++++--------!!!!!!!!!
> 5 files changed, 104 insertions(+), 20 deletions(-), 35 modifications(!)
> 6416060e36e81bb3008d3a4b62862eb9446ade08 ffmpeg_git.diff
> diff -c -r ffmpeg_git_old/ffmpeg.c ffmpeg_git_new/ffmpeg.c
> *** ffmpeg_git_old/ffmpeg.c 2017-03-27 19:20:02.000000000 +0300
> --- ffmpeg_git_new/ffmpeg.c 2017-03-28 17:25:10.000000000 +0300
> ***************
> *** 4028,4033 ****
Please submit a git format patch, i think many people will have
difficulty reading this
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170328/cdf198e8/attachment.sig>
More information about the ffmpeg-devel
mailing list