#9632: Metadata not work with segment format
-------------------------------------+-------------------------------------
             Reporter:  Przemek      |                    Owner:  (none)
                 Type:  defect       |                   Status:  new
             Priority:  important    |                Component:  ffmpeg
              Version:  4.2.4        |               Resolution:
             Keywords:  segment      |               Blocked By:
  METADATA rotate                    |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Description changed by Przemek:

Old description:

> Summary of the bug:
> I'm trying to add rotation metadata to the video recorded from RTSP
> stream. All works fine until I try to run recording with segment format.
>
> How to reproduce:
> {{{
> % ffmpeg -rtsp_transport tcp -stimeout 1000000 -i "<RTSP>" -vcodec copy
> -map_metadata 0 -metadata:s:v rotate=270 -an -dn -y -segment_time 60
> -strftime 1 -reset_timestamps 1 -t 25 -f segment /home/short.mp4
> }}}
>
> I can see in logs that rotate should be written to the metadata as
> displaymatrix: rotation of -90.00 degrees
> {{{
> ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
>   built with gcc 7.3.0 (GCC)
>   configuration: --disable-stripping --enable-pic --enable-shared
> --enable-pthreads --cross-prefix=aarch64-poky-linux- --ld='aarch64-poky-
> linux-gcc -march=armv8-a+crc -fstack-protector-strong -D_FORTIFY_SOURCE=2
> -Wformat -Wformat-security -Werror=format-security
> --sysroot=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot' --cc='aarch64-poky-linux-gcc -march=armv8-a+crc -fstack-
> protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror
> =format-security --sysroot=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot' --cxx='aarch64-poky-linux-g++ -march=armv8-a+crc -fstack-
> protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror
> =format-security --sysroot=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot' --arch=aarch64 --target-os=linux --enable-cross-compile --extra-
> cflags=' -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-
> map=/home/ubuntu/przemoch/safeway-by-sternkraft/build/tmp/work/aarch64
> -poky-linux/ffmpeg/4.2.2-r0=/usr/src/debug/ffmpeg/4.2.2-r0 -fdebug-
> prefix-map=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot= -fdebug-prefix-map=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot-native= -march=armv8-a+crc -fstack-protector-strong
> -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security
> --sysroot=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
> -fstack-protector-strong -Wl,-z,relro,-z,now'
> --sysroot=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot --libdir=/usr/lib --shlibdir=/usr/lib --datadir=/usr/share/ffmpeg
> --disable-mipsdsp --disable-mipsdspr2 --cpu=generic --pkg-config=pkg-
> config --disable-static --enable-alsa --enable-avcodec --enable-avdevice
> --enable-avfilter --enable-avformat --enable-avresample --enable-bzlib
> --disable-libfdk-aac --enable-gpl --disable-libgsm --disable-indev=jack
> --disable-libvorbis --enable-lzma --disable-libmfx --disable-libmp3lame
> --disable-openssl --enable-postproc --disable-sdl2 --disable-libspeex
> --enable-swresample --enable-swscale --enable-libtheora --disable-vaapi
> --disable-vdpau --disable-libvpx --enable-libx264 --disable-libx265
> --enable-libxcb --enable-outdev=xv --enable-zlib
>   libavutil      56. 31.100 / 56. 31.100
>   libavcodec     58. 54.100 / 58. 54.100
>   libavformat    58. 29.100 / 58. 29.100
>   libavdevice    58.  8.100 / 58.  8.100
>   libavfilter     7. 57.100 /  7. 57.100
>   libavresample   4.  0.  0 /  4.  0.  0
>   libswscale      5.  5.100 /  5.  5.100
>   libswresample   3.  5.100 /  3.  5.100
>   libpostproc    55.  5.100 / 55.  5.100
> Input #0, rtsp, from
> 'rtsp://admin:[email protected]:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream':
>   Metadata:
>     title           : RTSP Session
>   Duration: N/A, start: 0.200000, bitrate: N/A
>     Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive),
> 1920x1080, 5 fps, 5 tbr, 90k tbn, 180k tbc
> Output #0, segment, to '/home/short.mp4':
>   Metadata:
>     title           : RTSP Session
>     encoder         : Lavf58.29.100
>     Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive),
> 1920x1080, q=2-31, 5 fps, 5 tbr, 90k tbn, 90k tbc
>     Side data:
>       displaymatrix: rotation of -90.00 degrees
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
> Press [q] to stop, [?] for help
> [segment @ 0x5594be0340] Timestamps are unset in a packet for stream 0.
> This is deprecated and will stop working in the future. Fix your code to
> set the timestamps properly
> [segment @ 0x5594be0340] Non-monotonous DTS in output stream 0:0;
> previous: 0, current: 0; changing to 1. This may result in incorrect
> timestamps in the output file.
> frame=   67 fps=8.6 q=-1.0 Lsize=N/A time=00:00:13.00 bitrate=N/A
> speed=1.67x
> }}}
> Unfortunately, there is no metadata in out video
> {{
> $ ffmpeg -i short.mp4
> ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
>   built with gcc 7.3.0 (GCC)
>   configuration: --disable-stripping --enable-pic --enable-shared
> --enable-pthreads --cross-prefix=aarch64-poky-linux- --ld='aarch64-poky-
> linux-gcc -march=armv8-a+crc -fstack-protector-strong -D_FORTIFY_SOURCE=2
> -Wformat -Wformat-security -Werror=format-security
> --sysroot=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot' --cc='aarch64-poky-linux-gcc -march=armv8-a+crc -fstack-
> protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror
> =format-security --sysroot=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot' --cxx='aarch64-poky-linux-g++ -march=armv8-a+crc -fstack-
> protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror
> =format-security --sysroot=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot' --arch=aarch64 --target-os=linux --enable-cross-compile --extra-
> cflags=' -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-
> map=/home/ubuntu/przemoch/safeway-by-sternkraft/build/tmp/work/aarch64
> -poky-linux/ffmpeg/4.2.2-r0=/usr/src/debug/ffmpeg/4.2.2-r0 -fdebug-
> prefix-map=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot= -fdebug-prefix-map=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot-native= -march=armv8-a+crc -fstack-protector-strong
> -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security
> --sysroot=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
> -fstack-protector-strong -Wl,-z,relro,-z,now'
> --sysroot=/home/ubuntu/przemoch/safeway-by-
> sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
> sysroot --libdir=/usr/lib --shlibdir=/usr/lib --datadir=/usr/share/ffmpeg
> --disable-mipsdsp --disable-mipsdspr2 --cpu=generic --pkg-config=pkg-
> config --disable-static --enable-alsa --enable-avcodec --enable-avdevice
> --enable-avfilter --enable-avformat --enable-avresample --enable-bzlib
> --disable-libfdk-aac --enable-gpl --disable-libgsm --disable-indev=jack
> --disable-libvorbis --enable-lzma --disable-libmfx --disable-libmp3lame
> --disable-openssl --enable-postproc --disable-sdl2 --disable-libspeex
> --enable-swresample --enable-swscale --enable-libtheora --disable-vaapi
> --disable-vdpau --disable-libvpx --enable-libx264 --disable-libx265
> --enable-libxcb --enable-outdev=xv --enable-zlib
>   libavutil      56. 31.100 / 56. 31.100
>   libavcodec     58. 54.100 / 58. 54.100
>   libavformat    58. 29.100 / 58. 29.100
>   libavdevice    58.  8.100 / 58.  8.100
>   libavfilter     7. 57.100 /  7. 57.100
>   libavresample   4.  0.  0 /  4.  0.  0
>   libswscale      5.  5.100 /  5.  5.100
>   libswresample   3.  5.100 /  3.  5.100
>   libpostproc    55.  5.100 / 55.  5.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'short.mp4':
>   Metadata:
>     major_brand     : isom
>     minor_version   : 512
>     compatible_brands: isomiso2avc1mp41
>     title           : RTSP Session
>     encoder         : Lavf58.29.100
>   Duration: 00:00:13.00, start: 0.000000, bitrate: 1024 kb/s
>     Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661),
> yuvj420p(pc, bt709), 1920x1080, 1023 kb/s, 5.15 fps, 5 tbr, 90k tbn, 180k
> tbc (default)
>     Metadata:
>       handler_name    : VideoHandler
> At least one output file must be specified
> }}
>
> Looks like segment purges metadata from the out file.
>
> Tested on ffmpeg 4.2.2 and 4.2.4 on Linux Mint

New description:

 Summary of the bug:
 I'm trying to add rotation metadata to the video recorded from RTSP
 stream. All works fine until I try to run recording with segment format.

 How to reproduce:
 {{{
 % ffmpeg -rtsp_transport tcp -stimeout 1000000 -i "<RTSP>" -vcodec copy
 -map_metadata 0 -metadata:s:v rotate=270 -an -dn -y -segment_time 60
 -strftime 1 -reset_timestamps 1 -t 25 -f segment /home/short.mp4
 }}}

 I can see in logs that rotate should be written to the metadata as
 displaymatrix: rotation of -90.00 degrees
 {{{
 ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
   built with gcc 7.3.0 (GCC)
   configuration: --disable-stripping --enable-pic --enable-shared
 --enable-pthreads --cross-prefix=aarch64-poky-linux- --ld='aarch64-poky-
 linux-gcc -march=armv8-a+crc -fstack-protector-strong -D_FORTIFY_SOURCE=2
 -Wformat -Wformat-security -Werror=format-security
 --sysroot=/home/ubuntu/przemoch/safeway-by-
 sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
 sysroot' --cc='aarch64-poky-linux-gcc -march=armv8-a+crc -fstack-
 protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror
 =format-security --sysroot=/home/ubuntu/przemoch/safeway-by-
 sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
 sysroot' --cxx='aarch64-poky-linux-g++ -march=armv8-a+crc -fstack-
 protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror
 =format-security --sysroot=/home/ubuntu/przemoch/safeway-by-
 sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
 sysroot' --arch=aarch64 --target-os=linux --enable-cross-compile --extra-
 cflags=' -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-
 map=/home/ubuntu/przemoch/safeway-by-sternkraft/build/tmp/work/aarch64
 -poky-linux/ffmpeg/4.2.2-r0=/usr/src/debug/ffmpeg/4.2.2-r0 -fdebug-prefix-
 map=/home/ubuntu/przemoch/safeway-by-sternkraft/build/tmp/work/aarch64
 -poky-linux/ffmpeg/4.2.2-r0/recipe-sysroot= -fdebug-prefix-
 map=/home/ubuntu/przemoch/safeway-by-sternkraft/build/tmp/work/aarch64
 -poky-linux/ffmpeg/4.2.2-r0/recipe-sysroot-native= -march=armv8-a+crc
 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
 -Werror=format-security --sysroot=/home/ubuntu/przemoch/safeway-by-
 sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
 sysroot' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
 -fstack-protector-strong -Wl,-z,relro,-z,now'
 --sysroot=/home/ubuntu/przemoch/safeway-by-
 sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
 sysroot --libdir=/usr/lib --shlibdir=/usr/lib --datadir=/usr/share/ffmpeg
 --disable-mipsdsp --disable-mipsdspr2 --cpu=generic --pkg-config=pkg-
 config --disable-static --enable-alsa --enable-avcodec --enable-avdevice
 --enable-avfilter --enable-avformat --enable-avresample --enable-bzlib
 --disable-libfdk-aac --enable-gpl --disable-libgsm --disable-indev=jack
 --disable-libvorbis --enable-lzma --disable-libmfx --disable-libmp3lame
 --disable-openssl --enable-postproc --disable-sdl2 --disable-libspeex
 --enable-swresample --enable-swscale --enable-libtheora --disable-vaapi
 --disable-vdpau --disable-libvpx --enable-libx264 --disable-libx265
 --enable-libxcb --enable-outdev=xv --enable-zlib
   libavutil      56. 31.100 / 56. 31.100
   libavcodec     58. 54.100 / 58. 54.100
   libavformat    58. 29.100 / 58. 29.100
   libavdevice    58.  8.100 / 58.  8.100
   libavfilter     7. 57.100 /  7. 57.100
   libavresample   4.  0.  0 /  4.  0.  0
   libswscale      5.  5.100 /  5.  5.100
   libswresample   3.  5.100 /  3.  5.100
   libpostproc    55.  5.100 / 55.  5.100
 Input #0, rtsp, from
 
'rtsp://admin:[email protected]:554/user=admin_password=tlJwpbo6_channel=1_stream=0.sdp?real_stream':
   Metadata:
     title           : RTSP Session
   Duration: N/A, start: 0.200000, bitrate: N/A
     Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive),
 1920x1080, 5 fps, 5 tbr, 90k tbn, 180k tbc
 Output #0, segment, to '/home/short.mp4':
   Metadata:
     title           : RTSP Session
     encoder         : Lavf58.29.100
     Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive),
 1920x1080, q=2-31, 5 fps, 5 tbr, 90k tbn, 90k tbc
     Side data:
       displaymatrix: rotation of -90.00 degrees
 Stream mapping:
   Stream #0:0 -> #0:0 (copy)
 Press [q] to stop, [?] for help
 [segment @ 0x5594be0340] Timestamps are unset in a packet for stream 0.
 This is deprecated and will stop working in the future. Fix your code to
 set the timestamps properly
 [segment @ 0x5594be0340] Non-monotonous DTS in output stream 0:0;
 previous: 0, current: 0; changing to 1. This may result in incorrect
 timestamps in the output file.
 frame=   67 fps=8.6 q=-1.0 Lsize=N/A time=00:00:13.00 bitrate=N/A
 speed=1.67x
 }}}
 Unfortunately, there is no metadata in out video

 {{{
 $ ffmpeg -i short.mp4
 ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
   built with gcc 7.3.0 (GCC)
   configuration: --disable-stripping --enable-pic --enable-shared
 --enable-pthreads --cross-prefix=aarch64-poky-linux- --ld='aarch64-poky-
 linux-gcc -march=armv8-a+crc -fstack-protector-strong -D_FORTIFY_SOURCE=2
 -Wformat -Wformat-security -Werror=format-security
 --sysroot=/home/ubuntu/przemoch/safeway-by-
 sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
 sysroot' --cc='aarch64-poky-linux-gcc -march=armv8-a+crc -fstack-
 protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror
 =format-security --sysroot=/home/ubuntu/przemoch/safeway-by-
 sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
 sysroot' --cxx='aarch64-poky-linux-g++ -march=armv8-a+crc -fstack-
 protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror
 =format-security --sysroot=/home/ubuntu/przemoch/safeway-by-
 sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
 sysroot' --arch=aarch64 --target-os=linux --enable-cross-compile --extra-
 cflags=' -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-
 map=/home/ubuntu/przemoch/safeway-by-sternkraft/build/tmp/work/aarch64
 -poky-linux/ffmpeg/4.2.2-r0=/usr/src/debug/ffmpeg/4.2.2-r0 -fdebug-prefix-
 map=/home/ubuntu/przemoch/safeway-by-sternkraft/build/tmp/work/aarch64
 -poky-linux/ffmpeg/4.2.2-r0/recipe-sysroot= -fdebug-prefix-
 map=/home/ubuntu/przemoch/safeway-by-sternkraft/build/tmp/work/aarch64
 -poky-linux/ffmpeg/4.2.2-r0/recipe-sysroot-native= -march=armv8-a+crc
 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security
 -Werror=format-security --sysroot=/home/ubuntu/przemoch/safeway-by-
 sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
 sysroot' --extra-ldflags='-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
 -fstack-protector-strong -Wl,-z,relro,-z,now'
 --sysroot=/home/ubuntu/przemoch/safeway-by-
 sternkraft/build/tmp/work/aarch64-poky-linux/ffmpeg/4.2.2-r0/recipe-
 sysroot --libdir=/usr/lib --shlibdir=/usr/lib --datadir=/usr/share/ffmpeg
 --disable-mipsdsp --disable-mipsdspr2 --cpu=generic --pkg-config=pkg-
 config --disable-static --enable-alsa --enable-avcodec --enable-avdevice
 --enable-avfilter --enable-avformat --enable-avresample --enable-bzlib
 --disable-libfdk-aac --enable-gpl --disable-libgsm --disable-indev=jack
 --disable-libvorbis --enable-lzma --disable-libmfx --disable-libmp3lame
 --disable-openssl --enable-postproc --disable-sdl2 --disable-libspeex
 --enable-swresample --enable-swscale --enable-libtheora --disable-vaapi
 --disable-vdpau --disable-libvpx --enable-libx264 --disable-libx265
 --enable-libxcb --enable-outdev=xv --enable-zlib
   libavutil      56. 31.100 / 56. 31.100
   libavcodec     58. 54.100 / 58. 54.100
   libavformat    58. 29.100 / 58. 29.100
   libavdevice    58.  8.100 / 58.  8.100
   libavfilter     7. 57.100 /  7. 57.100
   libavresample   4.  0.  0 /  4.  0.  0
   libswscale      5.  5.100 /  5.  5.100
   libswresample   3.  5.100 /  3.  5.100
   libpostproc    55.  5.100 / 55.  5.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'short.mp4':
   Metadata:
     major_brand     : isom
     minor_version   : 512
     compatible_brands: isomiso2avc1mp41
     title           : RTSP Session
     encoder         : Lavf58.29.100
   Duration: 00:00:13.00, start: 0.000000, bitrate: 1024 kb/s
     Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc,
 bt709), 1920x1080, 1023 kb/s, 5.15 fps, 5 tbr, 90k tbn, 180k tbc (default)
     Metadata:
       handler_name    : VideoHandler
 At least one output file must be specified
 }}}

 Looks like segment purges metadata from the out file.

 Tested on ffmpeg 4.2.2 and 4.2.4 on Linux Mint

--
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9632#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

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

Reply via email to