Opened 6 years ago

Closed 5 years ago

#7293 closed defect (fixed)

rtp_mpegts muxer: metadata is dropped

Reported by: barsnick Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mpegts, rtp_mpegts
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
The rtp_mpegts muxer does not provide metadata from the demuxer or from the user's command line to its output stream.

Reported here:
http://ffmpeg.org/pipermail/ffmpeg-user/2018-June/040383.html
with more logs here:
http://ffmpeg.org/pipermail/ffmpeg-user/2018-July/040416.html

How to reproduce:

$ ffmpeg -f lavfi -i testsrc2 -metadata "service_name=Some Channel Name" -c:v libx264 -f rtp_mpegts rtp://127.0.0.1:5000?pkt_size=1316
$ ffmpeg -i rtp://127.0.0.1:5000?pkt_size=1316

Actual output of the second command:

Input #0, rtp, from 'rtp://127.0.0.1:5000?pkt_size=1316':
  Duration: N/A, start: 26.640000, bitrate: N/A
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
At least one output file must be specified

Expected output of the second command:

Input #0, rtp, from 'rtp://127.0.0.1:5000?pkt_size=1316':
  Duration: N/A, start: 30.920000, bitrate: N/A
  Program 1
    Metadata:
      service_name    : Some Channel Name
      service_provider: FFmpeg
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
At least one output file must be specified

For completeness, the output of the first command:

ffmpeg version N-91361-g387464bea Copyright (c) 2000-2018 the FFmpeg developers
  built with icc (ICC) 14.0.3 20140422
  configuration: --prefix=/usr/new/tools/video/install/ffmpeg/2018-06-25 --cc=icc --cxx=icpc --enable-gpl --enable-version3 --enable-nonfree --disable-shared --enable-gnu
tls --enable-libcdio --enable-libfreetype --enable-libx264 --enable-libvpx --enable-libmp3lame --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --ena
ble-libtwolame --enable-librtmp --enable-libass --enable-libv4l2 --enable-libvidstab --enable-libfdk-aac --enable-libsmbclient --enable-libzvbi --enable-libtesseract --en
able-libzmq --enable-libopus --enable-libcodec2 --enable-libxml2
  libavutil      56. 18.102 / 56. 18.102
  libavcodec     58. 20.103 / 58. 20.103
  libavformat    58. 17.101 / 58. 17.101
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 25.100 /  7. 25.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Input #0, lavfi, from 'testsrc2':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0xa988640] using SAR=1/1
[libx264 @ 0xa988640] using cpu capabilities: MMX2 SSE2 Cache64
[libx264 @ 0xa988640] profile High, level 1.3
[mpegts @ 0xae69cc0] DEBUG: service_name = Service01, provider_name = FFmpeg
Output #0, rtp_mpegts, to 'rtp://127.0.0.1:5000?pkt_size=1316':
  Metadata:
    service_name    : Some Channel Name
    encoder         : Lavf58.17.101
    Stream #0:0: Video: h264 (libx264), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=-1--1, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.20.103 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=  257 fps= 63 q=-1.0 Lsize=     347kB time=00:00:10.16 bitrate= 280.2kbits/s speed=2.48x
video:347kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 18.231230%
[libx264 @ 0xa988640] frame I:2     Avg QP:19.57  size:  5383
[libx264 @ 0xa988640] frame P:76    Avg QP:26.63  size:  1931
[libx264 @ 0xa988640] frame B:179   Avg QP:31.53  size:  1108
[libx264 @ 0xa988640] consecutive B-frames:  4.7%  5.4%  5.8% 84.0%
[libx264 @ 0xa988640] mb I  I16..4: 40.5% 32.3% 27.2%
[libx264 @ 0xa988640] mb P  I16..4:  2.3%  5.1%  1.1%  P16..4: 13.1% 10.3%  6.9%  0.0%  0.0%    skip:61.1%
[libx264 @ 0xa988640] mb B  I16..4:  0.2%  0.2%  0.1%  B16..8: 20.0%  7.3%  2.0%  direct: 2.5%  skip:67.6%  L0:51.8% L1:43.0% BI: 5.3%
[libx264 @ 0xa988640] 8x8 transform intra:52.1% inter:31.9%
[libx264 @ 0xa988640] coded y,uvDC,uvAC intra: 10.5% 27.9% 24.2% inter: 5.3% 14.8% 12.3%
[libx264 @ 0xa988640] i16 v,h,dc,p: 73% 22%  6%  0%
[libx264 @ 0xa988640] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7% 10% 82%  1%  0%  0%  0%  0%  0%
[libx264 @ 0xa988640] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 42% 21% 32%  1%  1%  1%  1%  1%  1%
[libx264 @ 0xa988640] i8c dc,h,v,p: 55% 15% 28%  1%
[libx264 @ 0xa988640] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0xa988640] ref P L0: 55.1%  7.0% 22.5% 15.4%
[libx264 @ 0xa988640] ref B L0: 79.6% 16.3%  4.1%
[libx264 @ 0xa988640] ref B L1: 92.3%  7.7%
[libx264 @ 0xa988640] kb/s:276.90

The issue is presumably that, in rtpenc_mpegts.c:rtp_mpegts_write_header(), the metadata needs to be copied from AVFormatContext *s to AVFormatContext *mpegts_ctx. The latter is passed to avformat_new_stream(), which initializes the mpegts muxer, where the metadata is evaluated.

Change History (1)

comment:1 by Carl Eugen Hoyos, 5 years ago

Resolution: fixed
Status: newclosed
Version: unspecifiedgit-master

Your patch was committed as 270f94e132b623bd6717515b3a72c5f1c535190b

Note: See TracTickets for help on using tickets.