[FFmpeg-user] Preserving both Video and Data Streams in Output file

Victor Odouard vicviodlogin at gmail.com
Thu Jun 22 14:37:41 EEST 2017


Hello all,
I have a mpeg file that I would like to send to a stream, something like:

ffmpeg -i PumaMapping.mpg udp://239.0.0.1:1234

However, this input.mpg file has both a video stream and a data stream, the
latter of which I understand by default ffmpeg does not carry over. I want
to copy both streams to the output file/stream, but I haven't been able to
figure out how.

So I've been trying this:

ffmpeg -i PumaMapping.mpg -map 0 output.mpg

(I've replaced the udp address with an output file to make testing simpler
as I figure out this issue).This is the output I get:

ffmpeg version 3.3.1 Copyright (c) 2000-2017 the FFmpeg developers

built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)

configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads
--enable-version3 --enable-libspeex --enable-libvpx
--disable-decoder=libvpx --enable-libmp3lame --enable-libtheora
--enable-libvorbis --enable-libx264 --enable-avfilter
--enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters
--enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc
--arch=x86_64 --enable-runtime-cpudetect

  libavutil      55. 58.100 / 55. 58.100

  libavcodec     57. 89.100 / 57. 89.100

  libavformat    57. 71.100 / 57. 71.100

  libavdevice    57.  6.100 / 57.  6.100

  libavfilter     6. 82.100 /  6. 82.100

  libswscale      4.  6.100 /  4.  6.100

  libswresample   2.  7.100 /  2.  7.100

  libpostproc    54.  5.100 / 54.  5.100

Input #0, mpegts, from 'PumaMapping.mpg':

  Duration: 00:15:09.91, start: 1.851444, bitrate: 15577 kb/s

  Program 1

    Stream #0:0[0x11]: Video: h264 (Constrained Baseline) ([27][0][0][0] /
0x001B), yuv420p(progressive), 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97
tbr, 90k tbn, 59.94 tbc

    Stream #0:1[0x21]: Data: klv (KLVA / 0x41564C4B)

Stream mapping:

  Stream #0:0 -> #0:0 (h264 (native) -> mpeg1video (native))

  Stream #0:1 -> #0:1 (copy)

Press [q] to stop, [?] for help

[mpeg @ 0x7f89ce013a00] VBV buffer size not set, using default size of 130KB

If you want the mpeg file to be compliant to some specification

Like DVD, VCD or others, make sure you set the correct buffer size

[mpeg @ 0x7f89ce013a00] Invalid media type data for output stream #1

Could not write header for output file #0 (incorrect codec parameters ?):
Invalid argument

Error initializing output stream 0:0 --

Conversion failed!

I also tried this one:

ffmpeg -i PumaMapping.mpg -map 0 -codec copy output_2.mpg

But got a similar error message:

ffmpeg version 3.3.1 Copyright (c) 2000-2017 the FFmpeg developers

  built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)

  configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl
--enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx
--disable-decoder=libvpx --enable-libmp3lame --enable-libtheora
--enable-libvorbis --enable-libx264 --enable-avfilter
--enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters
--enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc
--arch=x86_64 --enable-runtime-cpudetect

  libavutil      55. 58.100 / 55. 58.100

  libavcodec     57. 89.100 / 57. 89.100

  libavformat    57. 71.100 / 57. 71.100

  libavdevice    57.  6.100 / 57.  6.100

  libavfilter     6. 82.100 /  6. 82.100

  libswscale      4.  6.100 /  4.  6.100

  libswresample   2.  7.100 /  2.  7.100

  libpostproc    54.  5.100 / 54.  5.100

Input #0, mpegts, from 'PumaMapping.mpg':

  Duration: 00:15:09.91, start: 1.851444, bitrate: 15577 kb/s

  Program 1

    Stream #0:0[0x11]: Video: h264 (Constrained Baseline) ([27][0][0][0] /
0x001B), yuv420p(progressive), 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97
tbr, 90k tbn, 59.94 tbc

    Stream #0:1[0x21]: Data: klv (KLVA / 0x41564C4B)

[mpeg @ 0x7ff51918e400] VBV buffer size not set, using default size of 130KB

If you want the mpeg file to be compliant to some specification

Like DVD, VCD or others, make sure you set the correct buffer size

[mpeg @ 0x7ff51918e400] Invalid media type data for output stream #1

Could not write header for output file #0 (incorrect codec parameters ?):
Invalid argument

Stream mapping:

  Stream #0:0 -> #0:0 (copy)

  Stream #0:1 -> #0:1 (copy)

    Last message repeated 1 times

As you can see from both console outputs, the input has two streams, an
H264 video stream and a KLV data stream. How can I preserve both of these
in the output?


Best wishes,

Victor


More information about the ffmpeg-user mailing list