[FFmpeg-user] Trouble adding multiple subtitle tracks to HLS variant stream
Hi all, I'm trying to convert a video into two HLS streams. This file has one video track, one audio track, and seven subtitle tracks, only three of which I am interested in. The resulting HLS streams will be a "high quality" and "standard quality" video stream, which, through the magic of var_stream_map, use the same audio track. These streams are played back via a hls.js-based player. Here is the call to ffmpeg to produce the two streams, sans subtitles: ffmpeg -i "input_file.mkv" \ -filter_complex "[0]split=2[s1][s2];[s1]scale='min(1920,iw)':-2[hd];[s2]scale='min(1280,iw)':-2[sd]" \ -map '[hd]' -c:v:0 libx264 -b:v:0 3800k \ -map '[sd]' -c:v:1 libx264 -b:v:1 2000k \ -map 0:1 -c:a:0 aac -b:a:0 192k -ac 2 \ -var_stream_map "a:0,agroup:audio v:0,agroup:audio v:1,agroup:audio" \ -f hls -master_pl_name master.m3u8 -hls_time 4 -hls_list_size 0 -hls_segment_type fmp4 -hls_segment_filename "live_%v_%04d.ts" "live_%v.m3u8" If I want to add subtitles, I have to first convert them to webvtt by adding: -map '0:2' -c:s:0 webvtt \ -map '0:3' -c:s:1 webvtt \ -map '0:4' -c:s:2 webvtt However, I'm not sure how to add my subtitles to the variant stream map. I assumed at first that I could use "sgroup" in the same manner as "agroup": -var_stream_map "a:0,agroup:audio s:0,sgroup:subtitle s:1,sgroup:subtitle s:2,sgroup:subtitle v:0,agroup:audio,sgroup:subtitle v:1,agroup:audio,sgroup:subtitle" However, I get this error: >No streams to mux were specified >Could not write header for output file #0 (incorrect codec parameters ?): >Invalid argument >Error initializing output stream 0:1 -- So it seems like s: cannot be alone in its own variant stream. If I drop the third subtitle track, I can get the first two to show up properly in master.m3u8 like this: -var_stream_map "a:0,agroup:audio v:0,agroup:audio,s:0,sgroup:subtitles v:1,agroup:audio,s:1,sgroup:subtitles" But of course this limits me to only as many subtitle tracks as I have video streams. Does anyone know what var_stream_map syntax I should use to get my third subtitle track to show up? Thanks, Michael (I'm using a static ffmpeg build; here's the version info:) ffmpeg version N-54088-gb0203fa72b-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2020 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg libavutil 56. 58.100 / 56. 58.100 libavcodec 58.105.100 / 58.105.100 libavformat58. 54.100 / 58. 54.100 libavdevice58. 11.101 / 58. 11.101 libavfilter 7. 87.100 / 7. 87.100 libswscale 5. 8.100 / 5. 8.100 libswresample 3. 8.100 / 3. 8.100 libpostproc55. 8.100 / 55. 8.100 ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] OVERLAY_CUDA and PGS Subtitle burn
Hi, Changed the input format: Video -> yuv420p Sub -> yuv*a*420p (to include Alpha Channel) Now the video is showing, but still no subtitles. Still get the error message: *Error while add the frame to buffer source(Internal bug, should not have happened).* ./ffmpeg -threads 1 -loglevel info -nostdin -y -fflags +genpts-fastseek \ -ss 00:00:00 -t 00:00:15 \ -extra_hw_frames 3 -vsync 0 -async 0 -filter_threads 1 -filter_complex_threads 1 \ -init_hw_device cuda=cuda -hwaccel cuda -filter_hw_device cuda -hwaccel_output_format cuda \ -i input.mkv \ * -filter_complex \ "[0:v]scale_npp=w=-1:h=720:interp_algo=lanczos:format=yuv420p[vid]; \ [0:s]format=yuva420p,hwupload[sub]; \ [vid][sub]overlay_cuda[v]" \*-map "[v]" -map 0:a \ -force_key_frames "expr:gte(t,n_forced*5)" \ -c:v h264_nvenc -preset:v slow -profile:v high -level:v 51 \ -rc:v cbr_hq -rc-lookahead:v 32 -refs:v 16 -cq:v 16 -bf:v 3 -b:v 2000K -minrate:v 2000K -maxrate:v 2000k -bufsize:v 8M -coder:v cabac -b_ref_mode:v middle \ -c:a libfdk_aac -ac 2 -ar 48000 -b:a 128k \ output.mkv On Thu, 17 Sep 2020 at 07:08, Panda Sing Cool wrote: > Hi everyone, > > i'm trying to use the OVERLAY_CUDA function to burn PGS titles over a > video and the result is not working. > i might misunderstand the usage of this function, so some help is welcome. > > The result of this command is a black screen with audio, using 'standard' > overlay filter is working fine, but slow ... > > Notice this message at the end of the log file (ffmpeg version > N-99194-g142ae27b1d ( compiled myself from git) ): > *Error while add the frame to buffer source(Internal bug, should not have > happened).* > > Thanks for any help. > > > *** > >./ffmpeg -threads 1 -loglevel info -nostdin -y -fflags +genpts-fastseek > \ >-ss 00:00:00 -t 00:01:00 \ >-extra_hw_frames 3 -vsync 0 -async 0 -filter_threads 1 > -filter_complex_threads 1 \ >-init_hw_device cuda=cuda -hwaccel cuda -filter_hw_device cuda > -hwaccel_output_format cuda \ >-i input.mkv \ >-filter_complex \ > > > * "[0:v]scale_npp=w=-1:h=720:interp_algo=lanczos:format=nv12[vid]; \ > [0:s]format=nv12,hwupload_cuda[sub]; \[vid][sub]overlay_cuda[v]" \* > -map "[v]" -map 0:a \ >-force_key_frames "expr:gte(t,n_forced*5)" \ >-c:v h264_nvenc -preset:v slow -profile:v high -level:v 51 \ >-rc:v cbr_hq -rc-lookahead:v 32 -refs:v 16 -cq:v 16 -bf:v 3 -b:v 2000K > -minrate:v 2000K -maxrate:v 2000k -bufsize:v 8M -coder:v cabac > -b_ref_mode:v middle \ >-c:a libfdk_aac -ac 2 -ar 48000 -b:a 128k \ >output.mkv > > > * LOG > > f*fmpeg version N-99194-g142ae27b1d *Copyright (c) 2000-2020 the FFmpeg > developers > built with gcc 10 (GCC) > configuration: --prefix=/home/users/work/ffmpeg_build > --pkg-config-flags=--static --extra-libs=-lpthread --extra-libs=-lm > --bindir=/home/users/work/ffmpeg_build/bin --enable-gpl --enable-libfdk_aac > --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvpx > --enable-libx264 --enable-libx265 --enable-vulkan --enable-nonfree > --enable-libnpp --enable-nvenc --enable-cuvid --enable-libass > --enable-libfontconfig --enable-libfreetype --enable-libfribidi > --enable-cuda > libavutil 56. 59.100 / 56. 59.100 > libavcodec 58.106.100 / 58.106.100 > libavformat58. 56.100 / 58. 56.100 > libavdevice58. 11.102 / 58. 11.102 > libavfilter 7. 87.100 / 7. 87.100 > libswscale 5. 8.100 / 5. 8.100 > libswresample 3. 8.100 / 3. 8.100 > libpostproc55. 8.100 / 55. 8.100 > Input #0, matroska,webm, from 'input.mkv': > Metadata: > encoder : libebml v1.3.10 + libmatroska v1.5.2 > creation_time : 2020-08-13T06:58:46.00Z > Duration: 00:57:53.06, start: 0.00, bitrate: 12993 kb/s > Chapter #0:0: start 0.00, end 508.424583 > Metadata: > title : Chapter 01 > Chapter #0:1: start 508.424583, end 1037.202833 > Metadata: > title : Chapter 02 > Chapter #0:2: start 1037.202833, end 1510.175333 > Metadata: > title : Chapter 03 > Chapter #0:3: start 1510.175333, end 2231.896333 > Metadata: > title : Chapter 04 > Chapter #0:4: start 2231.896333, end 2908.530625 > Metadata: > title : Chapter 05 > Chapter #0:5: start 2908.530625, end 3473.052917 > Metadata: > title : Chapter 06 > Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, SAR > 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) > Metadata: > BPS-eng : 10946248 > DURATION-eng: 00:57:53.05300 > NUMBER_OF_FRAMES-eng: 83270 > NUMBER_OF_BYTES-eng: 4752112489 > _STATISTICS_WRITING_APP-eng: mkvmerge v46.0.0 ('No Deeper Escape') > 64-bit > _STATISTICS_WRITING_
Re: [FFmpeg-user] OVERLAY_CUDA and PGS Subtitle burn
Hi, This will not work. overlay_cuda accept only these format: ( https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200318071955.2329-1-yyyaros...@gmail.com/ ) +static const enum AVPixelFormat supported_overlay_formats[] = {+ AV_PIX_FMT_NV12,+AV_PIX_FMT_YUV420P,+AV_PIX_FMT_YUVA420P,+ AV_PIX_FMT_NONE,+}; ./ffmpeg -i input.mkv -filter_complex '[0:v][0:s]overlay_cuda' outut.mkv ... Stream mapping: Stream #0:0 (h264) -> overlay_cuda:main (graph 0) Stream #0:2 (pgssub) -> overlay_cuda:overlay (graph 0) overlay_cuda (graph 0) -> Stream #0:0 (libx264) Stream #0:1 -> #0:1 (dts (dca) -> ac3 (native)) Press [q] to stop, [?] for help [matroska,webm @ 0x4a02540] sub2video: using 1920x1080 canvas *Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scaler_0'*Error reinitializing filters! Failed to inject frame into filter network: Function not implemented Error while processing the decoded data for stream #0:0 On Thu, 17 Sep 2020 at 07:14, Ted Park wrote: > Hi, > > > i'm trying to use the OVERLAY_CUDA function to burn PGS titles over a > video > > > > Try ffmpeg -I input.mkv -filter_complex ‘[0:v][0:s]overlay_cuda’ > > (Not completely sure it works with overlay cuda but that’s how you would do > it with overlay. > > > Regards, > > Ted Park > ___ > ffmpeg-user mailing list > ffmpeg-user@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-user > > To unsubscribe, visit link above, or email > ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] OVERLAY_CUDA and PGS Subtitle burn
Hi, > i'm trying to use the OVERLAY_CUDA function to burn PGS titles over a video > Try ffmpeg -I input.mkv -filter_complex ‘[0:v][0:s]overlay_cuda’ (Not completely sure it works with overlay cuda but that’s how you would do it with overlay. Regards, Ted Park ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] OVERLAY_CUDA and PGS Subtitle burn
Hi everyone, i'm trying to use the OVERLAY_CUDA function to burn PGS titles over a video and the result is not working. i might misunderstand the usage of this function, so some help is welcome. The result of this command is a black screen with audio, using 'standard' overlay filter is working fine, but slow ... Notice this message at the end of the log file (ffmpeg version N-99194-g142ae27b1d ( compiled myself from git) ): *Error while add the frame to buffer source(Internal bug, should not have happened).* Thanks for any help. *** ./ffmpeg -threads 1 -loglevel info -nostdin -y -fflags +genpts-fastseek \ -ss 00:00:00 -t 00:01:00 \ -extra_hw_frames 3 -vsync 0 -async 0 -filter_threads 1 -filter_complex_threads 1 \ -init_hw_device cuda=cuda -hwaccel cuda -filter_hw_device cuda -hwaccel_output_format cuda \ -i input.mkv \ -filter_complex \ * "[0:v]scale_npp=w=-1:h=720:interp_algo=lanczos:format=nv12[vid]; \ [0:s]format=nv12,hwupload_cuda[sub]; \[vid][sub]overlay_cuda[v]" \* -map "[v]" -map 0:a \ -force_key_frames "expr:gte(t,n_forced*5)" \ -c:v h264_nvenc -preset:v slow -profile:v high -level:v 51 \ -rc:v cbr_hq -rc-lookahead:v 32 -refs:v 16 -cq:v 16 -bf:v 3 -b:v 2000K -minrate:v 2000K -maxrate:v 2000k -bufsize:v 8M -coder:v cabac -b_ref_mode:v middle \ -c:a libfdk_aac -ac 2 -ar 48000 -b:a 128k \ output.mkv * LOG f*fmpeg version N-99194-g142ae27b1d *Copyright (c) 2000-2020 the FFmpeg developers built with gcc 10 (GCC) configuration: --prefix=/home/users/work/ffmpeg_build --pkg-config-flags=--static --extra-libs=-lpthread --extra-libs=-lm --bindir=/home/users/work/ffmpeg_build/bin --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-vulkan --enable-nonfree --enable-libnpp --enable-nvenc --enable-cuvid --enable-libass --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-cuda libavutil 56. 59.100 / 56. 59.100 libavcodec 58.106.100 / 58.106.100 libavformat58. 56.100 / 58. 56.100 libavdevice58. 11.102 / 58. 11.102 libavfilter 7. 87.100 / 7. 87.100 libswscale 5. 8.100 / 5. 8.100 libswresample 3. 8.100 / 3. 8.100 libpostproc55. 8.100 / 55. 8.100 Input #0, matroska,webm, from 'input.mkv': Metadata: encoder : libebml v1.3.10 + libmatroska v1.5.2 creation_time : 2020-08-13T06:58:46.00Z Duration: 00:57:53.06, start: 0.00, bitrate: 12993 kb/s Chapter #0:0: start 0.00, end 508.424583 Metadata: title : Chapter 01 Chapter #0:1: start 508.424583, end 1037.202833 Metadata: title : Chapter 02 Chapter #0:2: start 1037.202833, end 1510.175333 Metadata: title : Chapter 03 Chapter #0:3: start 1510.175333, end 2231.896333 Metadata: title : Chapter 04 Chapter #0:4: start 2231.896333, end 2908.530625 Metadata: title : Chapter 05 Chapter #0:5: start 2908.530625, end 3473.052917 Metadata: title : Chapter 06 Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) Metadata: BPS-eng : 10946248 DURATION-eng: 00:57:53.05300 NUMBER_OF_FRAMES-eng: 83270 NUMBER_OF_BYTES-eng: 4752112489 _STATISTICS_WRITING_APP-eng: mkvmerge v46.0.0 ('No Deeper Escape') 64-bit _STATISTICS_WRITING_DATE_UTC-eng: 2020-08-13 06:58:46 _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:1(eng): Audio: dts (DTS-HD MA), 48000 Hz, 5.1(side), s16p Metadata: BPS-eng : 2022940 DURATION-eng: 00:57:53.05600 NUMBER_OF_FRAMES-eng: 325599 NUMBER_OF_BYTES-eng: 878223124 _STATISTICS_WRITING_APP-eng: mkvmerge v46.0.0 ('No Deeper Escape') 64-bit _STATISTICS_WRITING_DATE_UTC-eng: 2020-08-13 06:58:46 _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle, 1920x1080 Metadata: BPS-eng : 44076 DURATION-eng: 00:56:53.66000 NUMBER_OF_FRAMES-eng: 1450 NUMBER_OF_BYTES-eng: 18807980 _STATISTICS_WRITING_APP-eng: mkvmerge v46.0.0 ('No Deeper Escape') 64-bit _STATISTICS_WRITING_DATE_UTC-eng: 2020-08-13 06:58:46 _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream mapping: Stream #0:0 (h264) -> scale_npp (graph 0) Stream #0:2 (pgssub) -> format (graph 0) overlay_cuda (graph 0) -> Stream #0:0 (h264_nvenc) Stream #0:1 -> #0:1 (dts (dca) -> aac (libfdk_aac)) [matroska,webm @ 0x3a39bc0] sub2video: using 1920x1080 canvas Output #0, matroska, to 'output.mkv': Metadata: encoder : Lavf58.5
[FFmpeg-user] Data Metadata Tag lost in Conversion
ffmpeg -i rtsp://192.168.3.105:8554/hdz -map 0:1 -pix_fmt yuv420p -vcodec libx264 -r 25 -vf scale=1024:576 -threads 0 -b:v: 2048k -bufsize 2244k -maxrate 2560k -preset veryfast -profile:v baseline -tune zerolatency -g 100 -x264opts no-scenecut -f mpegts udp://fhp22-wowza.strax.co:5001?pkt_size=1316 -map 0:0 -codec copy -f mpegts udp://fhp22-media.strax.co:9001 I am using the following script to split the video and data streams from a mpegts formatted file being received through an RTSP link. When I run ffprobe on the rtsp feed I get told that stream 0 is: Stream #0:0[0x100]: Data: klv (KLVA / 0x41564C4B) I use the following ffmpeg script to read the input file: ffmpeg -i udp://localhost:9001 -c copy -map 0:0 -f data ./klv.txt This just hangs and never processes the data - I see the data coming into the 9001 port using tcpdump. When I run ffprobe on the data stream coming in it just hangs - no metadata info is displayed. It appears the metadata stream type info is getting lost on the splitting of the RTSP stream into 2 separate udp streams however the video stream works fine. I need to be able to either set the metadata type of the data stream in the script that sends the data stream or on the script that reads the stream - does anyone know how to do this? Tim -- Sent from: http://www.ffmpeg-archive.org/ ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] bwdif filter question
On Wed, Sep 16, 2020 at 02:58:25PM +0100, Mark Himsley wrote: > On Mon, 14 Sep 2020 at 15:42, Mark Filipak (ffmpeg) > wrote: > > > > Is the input to the bwdif filter fields or frames? > > The input to every filter in a filter chain is a raster of pixels. > That raster may contain one frame or two fields. > The bwdif filter will interpret a single raster and is designed to > output two rasters, each containing one or the other of the fields > that were contained in the input raster. It also can contain only single fields. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] Video Glossary (was: bwdif filter question)
On 09/16/2020 09:58 AM, Mark Himsley wrote: On Mon, 14 Sep 2020 at 15:42, Mark Filipak (ffmpeg) wrote: Is the input to the bwdif filter fields or frames? The input to every filter in a filter chain is a raster of pixels. That raster may contain one frame or two fields. The bwdif filter will interpret a single raster and is designed to output two rasters, each containing one or the other of the fields that were contained in the input raster. Thank you Mark. I note how you've employed the word "raster". I think that's a useful step. I've spent a month documenting the various macroblock formats (aka syntax) and creating various diagrams showing what I've learned along the way. The physical structure of frame data may be coming into focus, at least in my head and in my diagrams. It appears that the pictures people hold in their heads changes depending on context: 1, Encoded frames (slices, macroblocks, etc.) as found on-disc or in a stream, 2, Picture frames output by an input decoder, and 3, Picture structures v. half-picture structures (i.e. frames v. fields, what you are calling "rasters") within filter chains. Each is unique. Each has unique structure and usage. However, undifferentiated names (e.g. "frames", "fields", "interlace", "deinterlace") are being applied. People are relying on context to fill in the gaps. But when context goes unsaid, confusion reigns leaving us trapped in a video Tower of Babel. The confusion is not limited to this mailing list. The folks who wrote and revise the H.222 and H.242 specifications clearly also relied on context. The result is that H.222 & H.242 seem ambiguous and confusing. Appropriate contextual names based on physical data structures should be created to end the confusion. That is what I'm attempting. I invite interested people to join me in a glossary project. Regards, Mark. ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] bwdif filter question
On Mon, 14 Sep 2020 at 15:42, Mark Filipak (ffmpeg) wrote: > > Is the input to the bwdif filter fields or frames? The input to every filter in a filter chain is a raster of pixels. That raster may contain one frame or two fields. The bwdif filter will interpret a single raster and is designed to output two rasters, each containing one or the other of the fields that were contained in the input raster. -- Mark Himsley ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".