Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#2296 closed defect (fixed)

mpegts metadata can't be set on segments when using HLS muxer

Reported by: code-guru Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: metadata hls segment
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by Carl Eugen Hoyos)

I'm trying to set mpegts metadata on segments produced by hls muxer, but they won't get the metadata.

The following command can reproduce the problem:

bin/ffmpeg -v 99 -i ~/Videos/trailer_iphone.m4v -acodec copy -vcodec copy -vbsf h264_mp4toannexb -metadata service_provider="myProvider" -metadata service_name="myService" -f hls -y /tmp/out.m3u8 

The output of the above is the following:

ffmpeg version 1.1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb 22 2013 07:04:25 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1)
  configuration: --prefix=/home/me/ffmpeg/build/dist/ --enable-shared --enable-gpl --enable-nonfree --enable-libx264 --enable-libfaac --enable-libv4l2
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set libav* logging level) with argument '99'.
Reading option '-i' ... matched as input file with argument '/home/me/Videos/trailer_iphone.m4v'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'copy'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'copy'.
Reading option '-vbsf' ... matched as option 'vbsf' (deprecated) with argument 'h264_mp4toannexb'.
Reading option '-metadata' ... matched as option 'metadata' (add metadata) with argument 'service_provider=myProvider'.
Reading option '-metadata' ... matched as option 'metadata' (add metadata) with argument 'service_name=myService'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'hls'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '/tmp/out.m3u8' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set libav* logging level) with argument 99.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file /home/me/Videos/trailer_iphone.m4v.
Successfully parsed a group of options.
Opening an input file: /home/me/Videos/trailer_iphone.m4v.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8566fc0] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8566fc0] ISO: File Type Major Brand: M4VP
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8566fc0] File position before avformat_find_stream_info() is 14880
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8566fc0] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8566fc0] File position after avformat_find_stream_info() is 21646
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/me/Videos/trailer_iphone.m4v':
  Metadata:
    major_brand     : M4VP
    minor_version   : 1
    compatible_brands: M4VPM4A mp42isom
    creation_time   : 2008-03-18 09:48:34
  Duration: 00:00:33.02, start: 0.000000, bitrate: 942 kb/s
    Stream #0:0(eng), 22, 1/44100: Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s
    Metadata:
      creation_time   : 2008-03-18 09:48:34
      handler_name    : Apple Sound Media Handler
    Stream #0:1(eng), 1, 1/600: Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 480x270, 1/1200, 824 kb/s, 25 fps, 25 tbr, 600 tbn, 1200 tbc
    Metadata:
      creation_time   : 2008-03-18 09:48:34
      handler_name    : Apple Video Media Handler
Successfully openened the file.
Parsing a group of options: output file /tmp/out.m3u8.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument copy.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument copy.
Applying option vbsf (deprecated) with argument h264_mp4toannexb.
Applying option metadata (add metadata) with argument service_provider=myProvider.
Applying option metadata (add metadata) with argument service_name=myService.
Applying option f (force format) with argument hls.
Successfully parsed a group of options.
Opening an output file: /tmp/out.m3u8.
Successfully openened the file.
[mpegts @ 0x8577e40] muxrate VBR, pcr every 60 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, hls, to '/tmp/out.m3u8':
  Metadata:
    major_brand     : M4VP
    minor_version   : 1
    compatible_brands: M4VPM4A mp42isom
    service_provider: myProvider
    service_name    : myService
    encoder         : Lavf54.59.106
    Stream #0:0(eng), 0, 1/90000: Video: h264 (avc1 / 0x31637661), yuv420p, 480x270, 1/600, q=2-31, 824 kb/s, 25 fps, 90k tbn, 600 tbc
    Metadata:
      creation_time   : 2008-03-18 09:48:34
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng), 0, 1/90000: Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, 127 kb/s
    Metadata:
      creation_time   : 2008-03-18 09:48:34
      handler_name    : Apple Sound Media Handler
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[adts @ 0x8566340] Encoder did not produce proper pts, making some up.
No more output streams to write to, finishing.
frame=  812 fps=0.0 q=-1.0 Lsize=N/A time=00:00:33.04 bitrate=N/A    
video:3270kB audio:514kB subtitle:0 global headers:0kB muxing overhead -100.000568%
[AVIOContext @ 0x856f5e0] Statistics: 3889885 bytes read, 0 seeks

Inspecting the output with ffprobe

 bin/ffprobe -v 99  /tmp/out1.ts 

The probe result

ffprobe version 1.1.2 Copyright (c) 2007-2013 the FFmpeg developers
  built on Feb 22 2013 07:04:25 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1)
  configuration: --prefix=/home/me/ffmpeg/build/dist/ --enable-shared --enable-gpl --enable-nonfree --enable-libx264 --enable-libfaac --enable-libv4l2
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mpegts @ 0x869aea0] Format mpegts probed with size=2048 and score=100
[mpegts @ 0x869aea0] stream=0 stream_type=1b pid=100 prog_reg_desc=
[mpegts @ 0x869aea0] stream=1 stream_type=f pid=101 prog_reg_desc=
[mpegts @ 0x869aea0] File position before avformat_find_stream_info() is 0
[h264 @ 0x869ed80] Current profile doesn't provide more RBSP data in PPS, skipping
[mpegts @ 0x869aea0] File position after avformat_find_stream_info() is 0
Input #0, mpegts, from '/tmp/out1.ts':
  Duration: 00:00:04.28, start: 4.800000, bitrate: 946 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100], 107, 1/90000: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 480x270, 1/180000, 25 tbr, 90k tbn, 180k tbc
    Stream #0:1[0x101], 185, 1/90000: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 135 kb/s
[h264 @ 0x869ed80] detected 4 logical cores
[AVIOContext @ 0x86a34a0] Statistics: 756284 bytes read, 2 seeks

As it seems from the above outputs, the mpegts segments haven't got the metadata.

Thanks for you consideration.

Change History (2)

comment:1 by Carl Eugen Hoyos, 11 years ago

Component: FFmpegavformat
Description: modified (diff)
Keywords: metadata segment added; libavformat segments removed
Resolution: duplicate
Status: newclosed
Version: 1.1.2git-master

Duplicate of ticket #2230
Patch on mailing list: http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/159604

comment:2 by Michael Niedermayer, 10 years ago

Resolution: duplicatefixed

This was not a duplicate
fixed in d780fdb904a4a3f555252fad6b898534c9af128b

Note: See TracTickets for help on using tickets.