mpegts metadata not set

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

mpegts metadata not set

Christian Knoefel | Ilm-Provider
Hello,


i will remux an ts:

ffmpeg -re -i rtmp://live.net/rtmp/live -vcodec mpeg2video -s 720x576 -r
25 -flags cgop+ilme -sc_threshold 1000000000 -b:v 5M -minrate:v 5M
-maxrate:v 5M -bufsize:v 3.5M -acodec mp2 -ac 2 -b:a 192k -metadata
"service_provider=Some Provider" -metadata "service_name=Some Channel
Name" -f rtp_mpegts rtp://127.0.0.1:5000?pkt_size=1316

Stream mapping:
   Stream #0:1 -> #0:0 (h264 (native) -> mpeg2video (native))
   Stream #0:0 -> #0:1 (aac (native) -> mp2 (native))
Press [q] to stop, [?] for help
Output #0, rtp_mpegts, to 'rtp://127.0.0.1:5000?pkt_size=1316':
   Metadata:
     service_provider: Some Provider
     service_name    : Some Channel Name
     encoder         : Lavf58.17.100
     Stream #0:0: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45
DAR 16:9], q=2-31, 5000 kb/s, 25 fps, 90k tbn, 25 tbc
     Metadata:
       encoder         : Lavc58.20.103 mpeg2video
     Side data:
       cpb: bitrate max/min/avg: 5000000/5000000/5000000 buffer size:
3500000 vbv_delay: -1
     Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
     Metadata:
       encoder         : Lavc58.20.103 mp2


wit ffplay looks like this:

Input #0, rtp, from 'rtp://127.0.0.1:5000':   0KB sq=    0B f=0/0
   Duration: N/A, start: 91.443144, bitrate: 5192 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:1: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
yuv420p(tv, bottom first), 720x576 [SAR 64:45 DAR 16:9], 5000 kb/s, 25
fps, 25 tbr, 90k tbn, 50 tbc
     Stream #0:0: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo,
s16p, 192 kb/s

Why metadate are not set?

it is the newest 64bit windows build...


thanks for your suggestion...

Christian


_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Zak
Reply | Threaded
Open this post in threaded view
|

Re: mpegts metadata not set

Zak
On 2018-06-27 at 10:28 AM EDT, Christian Knoefel | Ilm-Provider wrote:

> Hello,
>
>
> i will remux an ts:
>
> ffmpeg -re -i rtmp://live.net/rtmp/live -vcodec mpeg2video -s 720x576 -r
> 25 -flags cgop+ilme -sc_threshold 1000000000 -b:v 5M -minrate:v 5M
> -maxrate:v 5M -bufsize:v 3.5M -acodec mp2 -ac 2 -b:a 192k -metadata
> "service_provider=Some Provider" -metadata "service_name=Some Channel
> Name" -f rtp_mpegts rtp://127.0.0.1:5000?pkt_size=1316
>
> Stream mapping:
>    Stream #0:1 -> #0:0 (h264 (native) -> mpeg2video (native))
>    Stream #0:0 -> #0:1 (aac (native) -> mp2 (native))
> Press [q] to stop, [?] for help
> Output #0, rtp_mpegts, to 'rtp://127.0.0.1:5000?pkt_size=1316':
>    Metadata:
>      service_provider: Some Provider
>      service_name    : Some Channel Name
>      encoder         : Lavf58.17.100
>      Stream #0:0: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 64:45
> DAR 16:9], q=2-31, 5000 kb/s, 25 fps, 90k tbn, 25 tbc
>      Metadata:
>        encoder         : Lavc58.20.103 mpeg2video
>      Side data:
>        cpb: bitrate max/min/avg: 5000000/5000000/5000000 buffer size:
> 3500000 vbv_delay: -1
>      Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
>      Metadata:
>        encoder         : Lavc58.20.103 mp2
>
>
> wit ffplay looks like this:
>
> Input #0, rtp, from 'rtp://127.0.0.1:5000':   0KB sq=    0B f=0/0
>    Duration: N/A, start: 91.443144, bitrate: 5192 kb/s
>    Program 1
>      Metadata:
>        service_name    : Service01
>        service_provider: FFmpeg
>      Stream #0:1: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002),
> yuv420p(tv, bottom first), 720x576 [SAR 64:45 DAR 16:9], 5000 kb/s, 25
> fps, 25 tbr, 90k tbn, 50 tbc
>      Stream #0:0: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo,
> s16p, 192 kb/s
>
> Why metadate are not set?
>
> it is the newest 64bit windows build...
>
>
> thanks for your suggestion...
>
> Christian

Hello Christian,

I suspect the root problem is this:

1. When FFmpeg (the first call, for transcoding/remuxing), when FFmpeg
creates the MPEG TS, where is it putting the "metadata"? The MPEG
transport stream protocol is SUPER old, I would be surprised if there
were less than a dozen ways to store metadata.

2. When FFplay tries to play back the MPEG TS stream, where is it
reading the metadata? Quite likely not the same place. I have no idea.

Here are some suggestions:

1. Consider what application you actually want to use for playback,
because they will support different types of metadata. VLC, for example,
supports VERY LITTLE metadata, which annoys me at times. Even if VLC
reads the format for the metadata, it will never show you certain keys,
it only shows you a few of the keys. For instance, "Get Info" on VLC
usually shows a key "Year" for streaming video, but I know the video has
"original air date" (year, month, and day), "copyright date", and
possibly other things. And then "Year" is "2018", and that's just not
right. That was the encoding year, probably. FFprobe can actually be
helpful determining what is going on with things like this if you have
no idea (because I have no idea how metadata is stored in MPEG transport
streams).

2. MAYBE try putting the -metadata arguments after the "-f rtp_mpegts"
argument. Sometimes (often) the order of arguments matters in FFmpeg. I
have no idea if that is the case here. Maybe it "processed" -metadata
early, when it thought you were going to use a MKV file as the output,
and it got that metadata all ready for a MKV file. Then it saw "-f
rtp_mpegts" and it threw away the things that go in MKV but not in MPEG
TS, and then re-generated some metadata for MPEG TS. This is a wild
guess, I would try it. The order of arguments mostly matters when the
arguments apply to specific streams (like audio versus video versus the
audio commentary). You can specify streams with (colon)(digit), such as
-c:v:2, but some arguments do not support that syntax (as far as I
know), so you need to put the argument in the group with that whole
stream, and the location tells it to go with "2".

3. Before somebody else asks, you might want to include the whole uncut
console output, including the "banner" printed by FFmpeg and FFplay that
says the configuration options when it was compiled, and so on. I
suspect it is not going to be hugely relevant, but you never know. You
did say it is the latest Windows build, but these Mailman archives will
be around for a long time, and what if you think you are using the
latest build because you installed it, but at the hour of typing the
command, your PATH variable decided to use an older version of FFmpeg
that was lying around somewhere on your hard drive? (There is a nice
xkcd comic about having tons of versions of the Python interpreter on
one machine, because computers get messy.)

Good luck,

Zak

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: mpegts metadata not set

Carl Eugen Hoyos-2
In reply to this post by Christian Knoefel | Ilm-Provider
2018-06-27 16:28 GMT+02:00, Christian Knoefel | Ilm-Provider
<[hidden email]>:

> ffmpeg -re -i rtmp://live.net/rtmp/live -vcodec mpeg2video -s 720x576 -r
> 25 -flags cgop+ilme -sc_threshold 1000000000 -b:v 5M -minrate:v 5M
> -maxrate:v 5M -bufsize:v 3.5M -acodec mp2 -ac 2 -b:a 192k -metadata
> "service_provider=Some Provider" -metadata "service_name=Some Channel
> Name" -f rtp_mpegts rtp://127.0.0.1:5000?pkt_size=1316

Complete, uncut console output missing.

This seems to be a limitation / bug in the rtp_mpegts muxer.

I don't think there is more than one way to put title and provider
into mpegts.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: mpegts metadata not set

Moritz Barsnick
In reply to this post by Christian Knoefel | Ilm-Provider
On Wed, Jun 27, 2018 at 16:28:26 +0200, Christian Knoefel | Ilm-Provider wrote:
> Hello,

Hi Christian,
thanks for providing the info.

As Carl Eugen mentioned, it's a bug/shortcoming of the rtp_mpegts
muxer. It's not passing the metadata on to the underlying mpegts muxer.
I have created trac ticket #7293 for you[*].

A fix for rtpenc_mpegts.c would look *something* like this:

     mpegts_ctx->oformat   = mpegts_format;
     mpegts_ctx->max_delay = s->max_delay;
+    mpegts_ctx->metadata = s->metadata;
     for (i = 0; i < s->nb_streams; i++) {
         AVStream* st = avformat_new_stream(mpegts_ctx, NULL);
         if (!st)

Note that this fix is probably not fully correct!!! It's just a proof
of concept. I tested it (just with one of your two metadatas), and it
"worked for me" (bug segfaults on exit).

Moritz

[*] https://trac.ffmpeg.org/ticket/7293
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: mpegts metadata not set

Dragan Randjelovic
I am experiencing similar issues once I want to name tracks and set
language code.

Regards.
Dragan R.

On Mon, Jul 2, 2018 at 11:24 AM, Moritz Barsnick <[hidden email]> wrote:

> On Wed, Jun 27, 2018 at 16:28:26 +0200, Christian Knoefel | Ilm-Provider
> wrote:
> > Hello,
>
> Hi Christian,
> thanks for providing the info.
>
> As Carl Eugen mentioned, it's a bug/shortcoming of the rtp_mpegts
> muxer. It's not passing the metadata on to the underlying mpegts muxer.
> I have created trac ticket #7293 for you[*].
>
> A fix for rtpenc_mpegts.c would look *something* like this:
>
>      mpegts_ctx->oformat   = mpegts_format;
>      mpegts_ctx->max_delay = s->max_delay;
> +    mpegts_ctx->metadata = s->metadata;
>      for (i = 0; i < s->nb_streams; i++) {
>          AVStream* st = avformat_new_stream(mpegts_ctx, NULL);
>          if (!st)
>
> Note that this fix is probably not fully correct!!! It's just a proof
> of concept. I tested it (just with one of your two metadatas), and it
> "worked for me" (bug segfaults on exit).
>
> Moritz
>
> [*] https://trac.ffmpeg.org/ticket/7293
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: mpegts metadata not set

Moritz Barsnick
In reply to this post by Moritz Barsnick
On Mon, Jul 02, 2018 at 11:24:18 +0200, Moritz Barsnick wrote:
> +    mpegts_ctx->metadata = s->metadata;
>
> Note that this fix is probably not fully correct!!!

At a quick glance, av_dict_copy() is probably the way to go, but that's
beyond the scope of my current investigations. ;-)

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".