[FFmpeg-user] Retain "private" data stream when converting to HLS or DASH
Michael.Craddick at sony.com
Michael.Craddick at sony.com
Tue Jun 22 23:14:14 EEST 2021
Hi,
A bit of background. I am attempting to use an mp4 (or at this point, even an mpegts) to contain ONLY data (no video, no audio – audio may be added at a later time).
1. I was able to create a temporary TS using a command similar to:
ffmpeg '-hide_banner' -loglevel debug -s 550x550 -f rawvideo -i - -c copy output.ts
1. It appears the mp4 encoder does not allow to directly embed data streams via pipe, so I also had to post-convert to an mp4 using a -map 0:d copy to build the mp4. I was able to extract the resulting data from both via a stdout pipe to a program.
2. My main goal is to actually stream this (preferable a fmpeg with DASH, but could use HLS if necessary). However, it seems whenever I convert to either HLS or DASH, the data stream is not in any of the output files.
Bonus Points: If anyone could point me on how to do this dynamically, I would ideally like to constantly stream incoming data to the HLS/DASH stream (either via piping the output from the intermediate TS or MP4 to the DASH/HLS).
Thank you in advance. Please let me know if you need any more information.
Regards,
--Mike Craddick.
FFPROBE seems to recognize the datastream, and as mentioned, I am able to parse out the stream.
ffprobe output2.mp4
ffprobe version 4.3.2 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf58.45.100
Duration: 00:01:18.60, start: 0.000000, bitrate: 90769 kb/s
Stream #0:0(und): Data: bin_data (gpmd / 0x646D7067), 90763 kb/s
Metadata:
handler_name : GoPro MET
Unsupported codec with id 100359 for input stream 0
Example of the issues when attempting to convert to HLS and DASH:
ffmpeg -y -loglevel debug -i output2.mp4 -g 1 -c copy -hls_time 2 -hls_playlist_type event -hls_segment_type fmp4 -hls_segment_filename 'file-sequence%d.m4s' -hls_flags independent_segments -map 0:d -c:d copy -movflags 'frag_keyframe+empty_moov' mp4_example.mp4 prog_index.m3u8 ✘ 1
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input url with argument 'output2.mp4'.
Reading option '-g' ... matched as AVOption 'g' with argument '1'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-hls_time' ... matched as AVOption 'hls_time' with argument '2'.
Reading option '-hls_playlist_type' ... matched as AVOption 'hls_playlist_type' with argument 'event'.
Reading option '-hls_segment_type' ... matched as AVOption 'hls_segment_type' with argument 'fmp4'.
Reading option '-hls_segment_filename' ... matched as AVOption 'hls_segment_filename' with argument 'file-sequence%d.m4s'.
Reading option '-hls_flags' ... matched as AVOption 'hls_flags' with argument 'independent_segments'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:d'.
Reading option '-c:d' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-movflags' ... matched as AVOption 'movflags' with argument 'frag_keyframe+empty_moov'.
Reading option 'mp4_example.mp4' ... matched as output url.
Reading option 'prog_index.m3u8' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url output2.mp4.
Successfully parsed a group of options.
Opening an input file: output2.mp4.
[NULL @ 0x7fb9a0008a00] Opening 'output2.mp4' for reading
[file @ 0x7fb99f904640] Setting default whitelist 'file,crypto,data'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb9a0008a00] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb9a0008a00] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb9a0008a00] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb9a0008a00] Processing st: 0, edit list 0 - media time: 0, duration: 7074000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb9a0008a00] Before avformat_find_stream_info() pos: 891810192 bytes read:92432 seeks:1 nb_streams:1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb9a0008a00] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb9a0008a00] After avformat_find_stream_info() pos: 891810192 bytes read:92432 seeks:1 frames:0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output2.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf58.45.100
Duration: 00:01:18.60, start: 0.000000, bitrate: 90769 kb/s
Stream #0:0(und), 0, 1/90000: Data: bin_data (gpmd / 0x646D7067), 0/1, 90763 kb/s
Metadata:
handler_name : GoPro MET
Successfully opened the file.
Parsing a group of options: output url mp4_example.mp4.
Applying option c (codec name) with argument copy.
Applying option map (set input stream mapping) with argument 0:d.
Applying option c:d (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: mp4_example.mp4.
[file @ 0x7fb99f906380] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Parsing a group of options: output url prog_index.m3u8.
Successfully parsed a group of options.
Opening an output file: prog_index.m3u8.
Output #1, hls, to 'prog_index.m3u8':
Output file #1 does not contain any stream
[AVIOContext @ 0x7fb99f906540] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x7fb99f904740] Statistics: 92432 bytes read, 1 seeks
If I try to output the original TS file to a HLS, I received.a similar issue:
ffmpeg -y -i output2.ts -f hls hls_time 2 -hls_playlist_type event -hls_flags independent_segments -hls_segment_type mpegts hls_segment_filename 'data%02d.ts' -var_stream_map "d:0" stream_%v.m3u8 ✘ 1
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.0 (clang-1200.0.32.29)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mpegts, from 'output2.ts':
Duration: 00:01:18.60, start: 1.400000, bitrate: 92800 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Data: bin_data ([6][0][0][0] / 0x0006)
Output #0, hls, to 'hls_time':
Output file #0 does not contain any stream
More information about the ffmpeg-user
mailing list