[FFmpeg-user] editing video stream with KLV metadata

Claire Mantel clma at fotonik.dtu.dk
Thu May 3 17:21:29 EEST 2018


Hello,

I have a videostream with klv metadata that I want to edit while keeping the metadata.
I'm wondering if it's possible with ffmpeg?

I tried several command lines, the two most relevant being the two below I believe.
However, in both cases I only get the video stream...

I also tried to retrieve the metadata in a file with
ffmpeg -ss 00:02:15.0 -i video_out_2018_05_01_14_11_53.ts -f ffmetadata testMetadata.txt
But that gives a file containing: ;FFMETADATA1 encoder=Lavf58.13.100
As if it was using data from the video stream and not the data stream.

Thanks for any help!
Claire

ffmpeg -ss 00:02:15.0 -i video_out_2018_05_01_14_11_53.ts -c:v copy -c:d copy EditMetadata.ts

ffmpeg version N-90926-gbad42e9b40 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 18.100 / 56. 18.100
  libavcodec     58. 19.100 / 58. 19.100
  libavformat    58. 13.100 / 58. 13.100
  libavdevice    58.  4.100 / 58.  4.100
  libavfilter     7. 21.100 /  7. 21.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
[mpegts @ 00000201640a9f40] PES packet size mismatch
    Last message repeated 1 times
Input #0, mpegts, from 'video_out_2018_05_01_14_11_53.ts':
  Duration: 00:08:14.40, start: 3600.000000, bitrate: 6676 kb/s
  Program 1
    Stream #0:0[0x41]: Video: h264 (Constrained Baseline) (HDMV / 0x564D4448), yuv420p(progressive), 1280x720, 22.17 tbr, 90k tbn, 180k tbc
    Stream #0:1[0x42]: Data: klv (KLVA / 0x41564C4B)
File '4minShakyLowLightMetadata.ts' already exists. Overwrite ? [y/N] y
Output #0, mpegts, to '4minShakyLowLightMetadata.ts':
  Metadata:
    encoder         : Lavf58.13.100
    Stream #0:0: Video: h264 (Constrained Baseline) (HDMV / 0x564D4448), yuv420p(progressive), 1280x720, q=2-31, 22.17 tbr, 90k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mpegts @ 00000201640a9f40] PES packet size mismatch5:54.08 bitrate=7835.8kbits/s speed=6.48x
frame= 7966 fps=145 q=-1.0 Lsize=  341290kB time=00:05:59.35 bitrate=7780.3kbits/s speed=6.54x
video:315714kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.101032%


the second is

ffmpeg -ss 00:02:15.0 -i video_out_2018_05_01_14_11_53.ts -codec:video copy -map_metadata:s:d 0:s:d -t 00:04:00.0 EditMetadataTrial2.ts

ffmpeg version N-90926-gbad42e9b40 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 18.100 / 56. 18.100
  libavcodec     58. 19.100 / 58. 19.100
  libavformat    58. 13.100 / 58. 13.100
  libavdevice    58.  4.100 / 58.  4.100
  libavfilter     7. 21.100 /  7. 21.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
[mpegts @ 0000020095249fc0] PES packet size mismatch
    Last message repeated 1 times
Input #0, mpegts, from 'video_out_2018_05_01_14_11_53.ts':
  Duration: 00:08:14.40, start: 3600.000000, bitrate: 6676 kb/s
  Program 1
    Stream #0:0[0x41]: Video: h264 (Constrained Baseline) (HDMV / 0x564D4448), yuv420p(progressive), 1280x720, 22.17 tbr, 90k tbn, 180k tbc
    Stream #0:1[0x42]: Data: klv (KLVA / 0x41564C4B)
Output #0, mpegts, to '4minShakyLowLightMetadataTrial2.ts':
  Metadata:
    encoder         : Lavf58.13.100
    Stream #0:0: Video: h264 (Constrained Baseline) (HDMV / 0x564D4448), yuv420p(progressive), 1280x720, q=2-31, 22.17 tbr, 90k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 5315 fps=131 q=-1.0 Lsize=  252496kB time=00:03:59.95 bitrate=8620.1kbits/s speed=5.89x
video:233637kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.071818%


More information about the ffmpeg-user mailing list