#4566 closed enhancement (wontfix)
ffmpeg won't copy metadata ("StreamTitle") from audio live stream (transcoding)
Reported by: | Easydoor | Owned by: | |
---|---|---|---|
Priority: | wish | Component: | avformat |
Version: | git-master | Keywords: | metadata icecast |
Cc: | Björn | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
It won't copy "StreamTitle" from input to output while transcoding input from mp3 to aac.
I'm using version v2.6.1 compiled by me on ubuntu 14.
I try simpliest transcoding with -c:a copy option and sending it to icecast v2.4.1 and as a client I'm using latest winamp and vlc.
In booth player as title is showing only the mount point (in this case mystream) from icecast:
icecast://source:mypass@x.x.x.x:8000/mystream
and not the StreamTitle from input file.
Why and how can I just pass it from input to output?
I don't think that problem is Icecast, because I try to stream with SAM Broadcaster and in Winamp I see updated StreamTitle in real time.
Here is the command line:
/root/ffmpeg_sources/ffmpeg*/./ffmpeg -stats -report -i http://streaming.streamonomy.com/ElectricFM -c:a copy -content_type audio/mpeg -f mp3 icecast://source:mypass@x.x.x.x:8000/mystream
and here is the output:
root@vs4063:~# /root/ffmpeg_sources/ffmpeg*/./ffmpeg -stats -report -i http://streaming.streamonomy.com/ElectricFM -c:a copy -content_type audio/mpeg -f mp3 icecast://source:mypass@x.x.x.x:8000/mystream ffmpeg started on 2015-03-23 at 03:01:01 Report written to "ffmpeg-20150323-030101.log" ffmpeg version 2.6.1 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libaacplus --enable-nonfree libavutil 54. 20.100 / 54. 20.100 libavcodec 56. 26.100 / 56. 26.100 libavformat 56. 25.101 / 56. 25.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 11.102 / 5. 11.102 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Input #0, mp3, from 'http://streaming.streamonomy.com/ElectricFM': Metadata: icy-br : 128 icy-description : ElectricFM plays today's dance hits! icy-genre : Electronic Dance Pop icy-name : ElectricFM.com - America's Real Dance! icy-pub : 1 icy-url : http://www.electricfm.com StreamTitle : KYGO f/ CONRAD - FIRESTONE Duration: N/A, start: 0.000000, bitrate: 128 kb/s Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s Output #0, mp3, to 'icecast://source:mypass@x.x.x.x:8000/mystream': Metadata: icy-br : 128 icy-description : ElectricFM plays today's dance hits! icy-genre : Electronic Dance Pop icy-name : ElectricFM.com - America's Real Dance! icy-pub : 1 icy-url : http://www.electricfm.com StreamTitle : KYGO f/ CONRAD - FIRESTONE TSSE : Lavf56.25.101 Stream #0:0: Audio: mp3, 44100 Hz, stereo, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help size= 2093kB time=00:02:13.95 bitrate= 128.0kbits/s video:0kB audio:2093kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.016237%
In winamp first track is original and second transcoded..
Here is with debug:
/root/ffmpeg_sources/ffmpeg*/./ffmpeg -stats -v 512 -report -i http://streaming.streamonomy.com/ElectricFM -c:a copy -content_type audio/mpeg -f mp3 icecast://source:mypass@x.x.x.x:8000/mystream/mystream ffmpeg started on 2015-03-23 at 03:51:36 Report written to "ffmpeg-20150323-035136.log" ffmpeg version 2.6.1 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libaacplus --enable-nonfree libavutil 54. 20.100 / 54. 20.100 libavcodec 56. 26.100 / 56. 26.100 libavformat 56. 25.101 / 56. 25.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 11.102 / 5. 11.102 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 3.100 / 53. 3.100 Splitting the commandline. Reading option '-stats' ... matched as option 'stats' (print progress report during encoding) with argument '1'. Reading option '-v' ... matched as option 'v' (set logging level) with argument '512'. Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'. Reading option '-i' ... matched as input file with argument 'http://streaming.streamonomy.com/ElectricFM'. Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'. Reading option '-content_type' ... matched as AVOption 'content_type' with argument 'audio/mpeg'. Reading option '-f' ... matched as option 'f' (force format) with argument 'mp3'. Reading option 'icecast://source:mypass@x.x.x.x:8000/mystream' ... matched as output file. Finished splitting the commandline. Parsing a group of options: global . Applying option stats (print progress report during encoding) with argument 1. Applying option v (set logging level) with argument 512. Applying option report (generate a report) with argument 1. Successfully parsed a group of options. Parsing a group of options: input file http://streaming.streamonomy.com/ElectricFM. Successfully parsed a group of options. Opening an input file: http://streaming.streamonomy.com/ElectricFM. [http @ 0x217cf80] request: GET /ElectricFM HTTP/1.1 User-Agent: Lavf/56.25.101 Accept: */* Range: bytes=0- Connection: close Host: streaming.streamonomy.com Icy-MetaData: 1 [http @ 0x217cf80] header='HTTP/1.0 200 OK' [http @ 0x217cf80] http_code=200 [http @ 0x217cf80] header='Accept-Ranges: none' [http @ 0x217cf80] header='Content-Type: audio/mpeg' [http @ 0x217cf80] header='icy-br:128' [http @ 0x217cf80] header='ice-audio-info: ice-samplerate=44100;ice-bitrate=128;ice-channels=2' [http @ 0x217cf80] header='icy-br:128' [http @ 0x217cf80] header='icy-description:ElectricFM plays today's dance hits!' [http @ 0x217cf80] header='icy-genre:Electronic Dance Pop' [http @ 0x217cf80] header='icy-name:ElectricFM.com - America's Real Dance!' [http @ 0x217cf80] header='icy-pub:1' [http @ 0x217cf80] header='icy-url:http://www.electricfm.com' [http @ 0x217cf80] header='Server: Icecast 2.3.3-kh8' [http @ 0x217cf80] header='Cache-Control: no-cache, no-store' [http @ 0x217cf80] header='Pragma: no-cache' [http @ 0x217cf80] header='Access-Control-Allow-Origin: *' [http @ 0x217cf80] header='Access-Control-Allow-Headers: Origin, Accept, X-Requested-With, Content-Type' [http @ 0x217cf80] header='Access-Control-Allow-Methods: GET, OPTIONS, HEAD' [http @ 0x217cf80] header='Connection: close' [http @ 0x217cf80] header='Expires: Mon, 26 Jul 1997 05:00:00 GMT' [http @ 0x217cf80] header='icy-metaint:16000' [http @ 0x217cf80] header='' [mp3 @ 0x217daa0] Format mp3 probed with size=2048 and score=51 [mp3 @ 0x217daa0] Before avformat_find_stream_info() pos: 0 bytes read:2508 seeks:0 [mp3 @ 0x217daa0] All info found [mp3 @ 0x217daa0] After avformat_find_stream_info() pos: 21504 bytes read:23824 seeks:0 frames:50 Input #0, mp3, from 'http://streaming.streamonomy.com/ElectricFM': Metadata: icy-br : 128 icy-description : ElectricFM plays today's dance hits! icy-genre : Electronic Dance Pop icy-name : ElectricFM.com - America's Real Dance! icy-pub : 1 icy-url : http://www.electricfm.com StreamTitle : PAUL OAKENFOLD and DISFUNKTION f/ SPITFIRE - BEAUTIFUL WORLD Duration: N/A, start: 0.000000, bitrate: 128 kb/s Stream #0:0, 50, 1/14112000: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s Successfully opened the file. Parsing a group of options: output file icecast://source:mypass@x.x.x.x:8000/mystream. Applying option c:a (codec name) with argument copy. Applying option f (force format) with argument mp3. Successfully parsed a group of options. Opening an output file: icecast://source:mypass@x.x.x.x:8000/mystream. [http @ 0x2191520] request: PUT /mystream HTTP/1.1 User-Agent: Lavf/56.25.101 Accept: */* Expect: 100-continue Connection: close Host: x.x.x.x:8000 Content-Type: audio/mpeg Icy-MetaData: 1 Ice-Public: 0 Authorization: Basic c291cmNlOnNpbnVzZm04MA== [http @ 0x2191520] header='HTTP/1.1 100 Continue' [http @ 0x2191520] http_code=100 [http @ 0x2191520] header='' Successfully opened the file. Output #0, mp3, to 'icecast://source:mypass@x.x.x.x:8000/mystream5.3': Metadata: icy-br : 128 icy-description : ElectricFM plays today's dance hits! icy-genre : Electronic Dance Pop icy-name : ElectricFM.com - America's Real Dance! icy-pub : 1 icy-url : http://www.electricfm.com StreamTitle : PAUL OAKENFOLD and DISFUNKTION f/ SPITFIRE - BEAUTIFUL WORLD TSSE : Lavf56.25.101 Stream #0:0, 0, 1/14112000: Audio: mp3, 44100 Hz, stereo, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help size= 101kB time=00:00:06.42 bitrate= 128.5kbits/s video:0kB audio:100kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.371530% Input file #0 (http://streaming.streamonomy.com/ElectricFM): Input stream #0:0 (audio): 246 packets read (102818 bytes); Total: 246 packets (102818 bytes) demuxed Output file #0 (icecast://source:mypass@x.x.x.x:8000/mystream): Output stream #0:0 (audio): 246 packets muxed (102818 bytes); Total: 246 packets (102818 bytes) muxed 0 frames successfully decoded, 0 decoding errors [AVIOContext @ 0x2192e80] Statistics: 0 seeks, 247 writeouts [AVIOContext @ 0x21884c0] Statistics: 105326 bytes read, 0 seeks
The main usage of transcoding would be:
/root/ffmpeg_sources/ffmpeg/./ffmpeg -stats -v 1024 -report -i http://stream2.electricfm.com -acodec libaacplus -ar 44.1k -ab 40k -ac 2 -content_type audio/aacp -f adts icecast://source:mypass@x.x.x.x:8000/electricfm@40k -acodec libaacplus -ar 44.1k -ab 64k -ac 2 -content_type audio/aacp -f adts icecast://source:mypass@x.x.x.x:8000/electricfm@64k < /dev/null >/dev/null 2>/var/log/ffmpeg.log &
but it gave me same result..not showing "StreamTitle" from input to output!
I try with options -map_metada 0:s:0 and others option, but without success.
Attachments (1)
Change History (19)
comment:1 by , 10 years ago
Component: | ffmpeg → avformat |
---|---|
Priority: | important → normal |
comment:2 by , 10 years ago
Keywords: | icecast added |
---|
comment:3 by , 10 years ago
I try recompile now from git as you said...
The version is:
ffmpeg version N-72231-g0d41f1f Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
But bothing new happend..
It still not working..all is same.
Can you check it again?
comment:4 by , 10 years ago
Priority: | normal → wish |
---|---|
Status: | new → open |
Type: | defect → enhancement |
Version: | 2.6.2 → git-master |
Afaict, the icecast protocol does not write the StreamTitle.
comment:5 by , 10 years ago
You mean when you feed it with ffmpeg?
Because it works if you feed icecast with SAM Broadcaster, I tried it.
comment:7 by , 7 years ago
Resolution: | → wontfix |
---|---|
Status: | open → closed |
This can't work with formats like mp3 or m4a (aac), as it requires out of band metadata sent to the Icecast server. This is not supported by the Icecast protocol in ffmpeg.
It should work fine with supported formats, like ogg, which are capable to properly contain metadata in a non-hacky way.
comment:8 by , 7 years ago
Icecast doesn't support sending out-of-band metdata directly, but it has API endpoints to update the stream metadata. Other broadcast software uses them, like this one for example: https://github.com/stunndard/goicy/blob/master/metadata/metadata.go
Two problems need to be solved to implement the feature in FFmpeg:
- Triggering a notification when metadata changes (i.e. when a new input file is opened or a server sends an update)
- Sending an API request to the Icecast server when the notification is triggered
The latter should be easy to implement using libavformat's HTTP module, but the former could be difficult as every compatible protocol/demuxer needs to be changed. Plus, I'm not sure if FFmpeg supports this kind of asynchronous notification.
I don't think the ticket should be closed, though, as this is a very useful feature and it should be possible to implement it without relying on hacks.
follow-up: 11 comment:10 by , 2 years ago
I'm attaching a patch against branch 5.1 that does this in a way that prioritizes functionality over code acceptability. I really hope this will get properly fixed eventually in ffmpeg I'm just sharing the patch for anyone who needs the functionality. I'm not asking for this patch to be applied but I would like for it to be implemented properly. This patch at least outlines the necessary changes.
comment:11 by , 2 years ago
Replying to Cristian Onet:
I'm attaching a patch against branch 5.1 that does this in a way that prioritizes functionality over code acceptability. I hope this will get properly fixed eventually in FFmpeg I'm just sharing the patch for anyone who needs the functionality. I'm not asking for this patch to be applied but I would like for it to be implemented properly. This patch at least outlines the necessary changes.
Hi Christian,
Funny but after 8 years I am still interested in this option a lot. :)
Thank you for your effort.
I will try to apply the patch in the upcoming days, and let you know if I succeed.
comment:12 by , 2 years ago
I'm glad to hear that it could still be useful, I updated the patch to support special characters like '&' and '#' in the metadata, previously these did not work because of the way the metadata update URL was built.
by , 2 years ago
Attachment: | propagate-metadata-changes-to-icecast-outputs.patch added |
---|
Patch that forwards StreamTitle as icecast mertadata
comment:13 by , 2 years ago
My C is a bit rusty so I forgot to terminate the escaped metadata, hence the updated patch.
comment:15 by , 14 months ago
Hi Christian,
I just found some time to apply your patch to the actual version of the FFMpeg.
Sadly, but it is not possible to compile the code. :(
I got a lot of errors like:
HOSTCC doc/print_options.o CC fftools/ffmpeg_dec.o CC fftools/ffmpeg_demux.o CC fftools/ffmpeg_enc.o CC fftools/ffmpeg_filter.o CC fftools/ffmpeg_hw.o CC fftools/ffmpeg_mux.o CC fftools/ffmpeg_mux_init.o CC fftools/ffmpeg_opt.o CC fftools/objpool.o CC fftools/sync_queue.o CC fftools/thread_queue.o CC fftools/cmdutils.o CC fftools/opt_common.o CC fftools/ffmpeg.o fftools/ffmpeg.c: In function ‘transcode’: fftools/ffmpeg.c:1196:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement] 1196 | int propagate_metadata_updates = 0; | ^~~ fftools/ffmpeg.c:1198:36: error: ‘OutputFile’ has no member named ‘ctx’ 1198 | if (strncmp(output_files[i]->ctx->url, "icecast://", 10) == 0) { | ^~ fftools/ffmpeg.c:1236:25: error: ‘nb_input_streams’ undeclared (first use in this function); did you mean ‘nb_input_files’? 1236 | for (i = 0; i < nb_input_streams && propagate_metadata_updates; i++) { | ^~~~~~~~~~~~~~~~ | nb_input_files fftools/ffmpeg.c:1236:25: note: each undeclared identifier is reported only once for each function it appears in fftools/ffmpeg.c:1237:19: error: ‘input_streams’ undeclared (first use in this function); did you mean ‘InputStream’? 1237 | ist = input_streams[i]; | ^~~~~~~~~~~~~ | InputStream fftools/ffmpeg.c:1242:50: error: ‘OutputFile’ has no member named ‘ctx’ 1242 | av_dict_copy(&output_files[i]->ctx->metadata, input_files[ist->file_index]->ctx->metadata, 0); | ^~ fftools/ffmpeg.c:1243:36: error: ‘OutputFile’ has no member named ‘ctx’ 1243 | output_files[i]->ctx->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED; | ^~ make: *** [ffbuild/common.mak:81: fftools/ffmpeg.o] Error 1 make: *** Waiting for unfinished jobs.... STRIP libavutil/x86/tx_float.o root@vmi1513936:~/ffmpeg_sources/ffmpeg#
Could you please apply the new patch when you have a moment?
Thank you in advance.
comment:16 by , 14 months ago
Hi,
Forgot to mention that I did the compile on:
Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy Linux vmi1513936 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
comment:18 by , 6 weeks ago
Cc: | added |
---|
Please test current FFmpeg git head.