Metadata text length

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Metadata text length

FFmpeg-users mailing list
I think the patch here: https://patchwork.ffmpeg.org/patch/12047 has
introduced a limit to the length of plain ASCII text that can be written
into mpegts metadata fields. I'm seeing ffmpeg exit when trying to write
a string of more than ~150 characters with "Too long service or provider
name".

Is there a designed or documented limit - I can't see one from a brief
look at the code, perhaps I'm missing something ?

Thanks

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://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: Metadata text length

Moritz Barsnick
On Mon, Mar 18, 2019 at 19:40:41 +0000, FFmpeg user discussions wrote:
> I think the patch here: https://patchwork.ffmpeg.org/patch/12047 has
> introduced a limit to the length of plain ASCII text that can be written
> into mpegts metadata fields. I'm seeing ffmpeg exit when trying to write
> a string of more than ~150 characters with "Too long service or provider
> name".

You should show us your actual command line and its complete, uncut
console output.

> Is there a designed or documented limit - I can't see one from a brief
> look at the code, perhaps I'm missing something ?

From a quick glance, it looks like it's implemented as 254, but
multibyte characters (such as UTF-8) count as just that, multiple
bytes.

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://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: Metadata text length

FFmpeg-users mailing list
On 18/03/2019 20:25, Moritz Barsnick wrote:
> On Mon, Mar 18, 2019 at 19:40:41 +0000, FFmpeg user discussions wrote:
>> I think the patch here: https://patchwork.ffmpeg.org/patch/12047 has
>> introduced a limit to the length of plain ASCII text that can be written
>> into mpegts metadata fields. I'm seeing ffmpeg exit when trying to write
>> a string of more than ~150 characters with "Too long service or provider
>> name".
> You should show us your actual command line and its complete, uncut
> console output.
This is the 2nd stage of a 2 stage conversion, the last stage concats
intermediate files when needed, manipulates stream order and adds
metadata for several formats when required (hence a lot of unnecessary
metadata for ts or m2ts formats - but same result).
Removing the excess metadata makes no difference, the code takes the
long "title" string and tries to put it into "service name" by my
reading.  ~150 char seems to be the limit (previously didn't hit a
limit).  The long Title and other tags are used in other formats like
mkv and m4a podcasts.

Obvious workaround - I just want to know what number to truncate to, it
seems rather less than 254, without UTF chars.

ffmpeg -y -probesize 250M -analyzeduration 600M -copytb 1 -i
concat:"/mnt/lvm/TV/Great_Continental_Railway_Journeys/Warsaw_to_Krakow_-_Part_2/2019-03-13.18.30.3-0.rec/intermediate-file-1.ts|"       
-metadata service_provider="BBC TWO"      -metadata title="Great
Continental Railway Journeys-Warsaw to Krakow - Part
2-EP:EP016377310044-2019-03-13-Wed_18-30: Beginning in Warsaw, Michael
is puzzled by how a city famously razed to the ground after the Second
World War can appear so beautifully preserved. He hitches a ride in a
1913 carriage to discover one of the secrets of its restoration."     
-metadata year="2019"      -metadata date="2019"      -metadata
album="2019"      -metadata track="11"      -metadata author="Michael
Portillo"      -metadata artist="Michael Portillo"      -metadata
album_artist="Great Continental Railway Journeys"      -metadata
genre="A1"      -metadata episode_id="EP016377310044"      -metadata
show="Great Continental Railway Journeys"      -metadata
description="Beginning in Warsaw, Michael is puzzled by how a city
famously razed to the ground after the Second World War can appear so
beautifully preserved. He hitches a ride in a 1913 carriage to discover
one of the secrets of its restoration."      -metadata
comment="Beginning in Warsaw, Michael is puzzled by how a city famously
razed to the ground after the Second World War can appear so beautifully
preserved. He hitches a ride in a 1913 carriage to discover one of the
secrets of its restoration."      -metadata language="eng"     
-metadata publisher="BBC TWO"         -c copy -flags +global_header 
-map 0:0 -map 0:1
"/mnt/lvm/TV/Great_Continental_Railway_Journeys/Warsaw_to_Krakow_-_Part_2/Great
Continental Railway Journeys-Warsaw to Krakow - Part
2-EP-EP016377310044-2019-03-13-Wed_18-30-SD.m2ts" 2>> /var/log/tmp.log

ffmpeg version N-93395-g15d016be30 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 4.8 (SUSE Linux)
  configuration: --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --disable-doc --enable-libx264 --enable-libopus --enable-libopenjpeg --enable-libwebp --enable-gpl --enable-libx265 --enable-libfdk_aac --enable-libmp3lame --enable-libsoxr --enable-nonfree --disable-debug --logfile=log
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 47.103 / 58. 47.103
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, mpegts, from 'concat:/mnt/lvm/TV/Great_Continental_Railway_Journeys/Warsaw_to_Krakow_-_Part_2/2019-03-13.18.30.3-0.rec/intermediate-file-1.ts|':
  Duration: 00:02:00.32, start: 1.400000, bitrate: 228 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(top first), 704x576 [SAR 16:11 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101](eng): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 136 kb/s
[mpegts @ 0x344a780] Too long service or provider name
Could not write header for output file #0 (incorrect codec parameters ?): Cannot allocate memory
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times

>> Is there a designed or documented limit - I can't see one from a brief
>> look at the code, perhaps I'm missing something ?
> From a quick glance, it looks like it's implemented as 254, but
> multibyte characters (such as UTF-8) count as just that, multiple
> bytes.
>
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".


_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://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: Metadata text length

Marton Balint


On Mon, 18 Mar 2019, Richard F via ffmpeg-user wrote:

> On 18/03/2019 20:25, Moritz Barsnick wrote:
>> On Mon, Mar 18, 2019 at 19:40:41 +0000, FFmpeg user discussions wrote:
>>> I think the patch here: https://patchwork.ffmpeg.org/patch/12047 has
>>> introduced a limit to the length of plain ASCII text that can be written
>>> into mpegts metadata fields. I'm seeing ffmpeg exit when trying to write
>>> a string of more than ~150 characters with "Too long service or provider
>>> name".
>> You should show us your actual command line and its complete, uncut
>> console output.
> This is the 2nd stage of a 2 stage conversion, the last stage concats
> intermediate files when needed, manipulates stream order and adds
> metadata for several formats when required (hence a lot of unnecessary
> metadata for ts or m2ts formats - but same result).
> Removing the excess metadata makes no difference, the code takes the
> long "title" string and tries to put it into "service name" by my
> reading.  ~150 char seems to be the limit (previously didn't hit a
> limit).  The long Title and other tags are used in other formats like
> mkv and m4a podcasts.
>
> Obvious workaround - I just want to know what number to truncate to, it
> seems rather less than 254, without UTF chars.

254 bytes are the limit for UTF8, 255 for ASCII. And only the "title"
metadata is affected as the mpegts muxer is using that for service name if
no "service_name" metadata is given. So alternatively you can specify a
"service_name" metadata field so the "title" metadata won't be
misinterpreted as service name.

The old code created broken SDT with long service or provider names by
the way...

Regards,
Marton
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

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