Opened 7 years ago
Last modified 5 years ago
#7138 new defect
Generating encrypted HLS segments with the fmp4 format results in a segfault
Reported by: | Dennis E. Mungai | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avformat |
Version: | git-master | Keywords: | hls |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
As stated above, attempting to generate encrypted HLS segments in the fmp4 format results in a segfault.
How to reproduce:
Take the sample snippet below, which generates encrypted HLS variants of the format fmp4:
/home/lin/bin/ffmpeg -stream_loop -1 -loglevel debug -threads 4 \ -init_hw_device cuda=cuda -hwaccel cuda -filter_hw_device cuda \ -filter_complex_threads 4 -vsync 1 -i '/home/lin/Desktop/src/sowdtow.webm' -filter_complex \ "['v:0']split=2[s0][s1]; \ [s0]hwupload,scale_npp=w=1920:h=1080:interp_algo=lanczos:format=yuv420p[v0]; \ [s1]hwupload,scale_npp=w=1280:h=720:interp_algo=lanczos:format=yuv420p[v1]" \ -b:v:0 4388k -c:v hevc_nvenc -preset slow -rc:v vbr_hq -profile:v main -level 4.1 \ -b:v:1 3413k -c:v hevc_nvenc -preset slow -rc:v vbr_hq -profile:v main -level 4.1 \ -b:a:0 256k -b:a:1 192k -c:a aac -ar 48000 -bsf:a aac_adtstoasc \ -map "[v0]" -map "[v1]" -map 0:a:0 -map 0:a:0 \ -f hls -hls_flags discont_start+split_by_time+delete_segments -hls_time 10 -hls_list_size 10 \ -var_stream_map "v:0,a:0 v:1,a:1" -master_pl_publish_rate 10 -master_pl_name master.m3u8 -hls_segment_type 1 -hls_key_info_file /home/lin/Desktop/src/test.keyinfo \ "/home/lin/Desktop/dest/vs%v/manifest.m3u8"
Now comes the console output:
ffmpeg version N-90652-g2108a67 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609 configuration: --pkg-config-flags=--static --prefix=/home/lin/bin --bindir=/home/lin/bin --extra-cflags=-I/home/lin/bin/include --extra-ldflags=-L/home/lin/bin/lib --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --enable-cuda-sdk --enable-cuvid --enable-libnpp --extra-cflags=-I../nv_sdk --extra-ldflags=-L../nv_sdk --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/ --enable-nvenc --nvccflags='-gencode arch=compute_61,code=sm_61 -O2' --enable-vaapi --disable-debug --enable-libvorbis --enable-libvpx --enable-libdrm --enable-gpl --cpu=native --enable-opengl --enable-libfdk-aac --enable-libx264 --enable-libx265 --extra-libs=-lpthread --enable-nonfree libavutil 56. 13.100 / 56. 13.100 libavcodec 58. 17.100 / 58. 17.100 libavformat 58. 11.101 / 58. 11.101 libavdevice 58. 2.100 / 58. 2.100 libavfilter 7. 14.100 / 7. 14.100 libswscale 5. 0.102 / 5. 0.102 libswresample 3. 0.101 / 3. 0.101 libpostproc 55. 0.100 / 55. 0.100 Splitting the commandline. Reading option '-stream_loop' ... matched as option 'stream_loop' (set number of times input stream shall be looped) with argument '-1'. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. Reading option '-threads' ... matched as AVOption 'threads' with argument '4'. Reading option '-init_hw_device' ... matched as option 'init_hw_device' (initialise hardware device) with argument 'cuda=cuda'. Reading option '-hwaccel' ... matched as option 'hwaccel' (use HW accelerated decoding) with argument 'cuda'. Reading option '-filter_hw_device' ... matched as option 'filter_hw_device' (set hardware device used when filtering) with argument 'cuda'. Reading option '-filter_complex_threads' ... matched as option 'filter_complex_threads' (number of threads for -filter_complex) with argument '4'. Reading option '-vsync' ... matched as option 'vsync' (video sync method) with argument '1'. Reading option '-i' ... matched as input url with argument '/home/lin/Desktop/src/sowdtow.webm'. Reading option '-filter_complex' ... matched as option 'filter_complex' (create a complex filtergraph) with argument '['v:0']split=2[s0][s1]; [s0]hwupload,scale_npp=w=1920:h=1080:interp_algo=lanczos:format=yuv420p[v0]; [s1]hwupload,scale_npp=w=1280:h=720:interp_algo=lanczos:format=yuv420p[v1]'. Reading option '-b:v:0' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '4388k'. Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'hevc_nvenc'. Reading option '-preset' ... matched as AVOption 'preset' with argument 'slow'. Reading option '-rc:v' ... matched as AVOption 'rc:v' with argument 'vbr_hq'. Reading option '-profile:v' ... matched as option 'profile' (set profile) with argument 'main'. Reading option '-level' ... matched as AVOption 'level' with argument '4.1'. Reading option '-b:v:1' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '3413k'. Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'hevc_nvenc'. Reading option '-preset' ... matched as AVOption 'preset' with argument 'slow'. Reading option '-rc:v' ... matched as AVOption 'rc:v' with argument 'vbr_hq'. Reading option '-profile:v' ... matched as option 'profile' (set profile) with argument 'main'. Reading option '-level' ... matched as AVOption 'level' with argument '4.1'. Reading option '-b:a:0' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '256k'. Reading option '-b:a:1' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '192k'. Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'. Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '48000'. Reading option '-bsf:a' ... matched as option 'bsf' (A comma-separated list of bitstream filters) with argument 'aac_adtstoasc'. Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '[v0]'. Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '[v1]'. Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a:0'. Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a:0'. Reading option '-f' ... matched as option 'f' (force format) with argument 'hls'. Reading option '-hls_flags' ... matched as AVOption 'hls_flags' with argument 'discont_start+split_by_time+delete_segments'. Reading option '-hls_time' ... matched as AVOption 'hls_time' with argument '10'. Reading option '-hls_list_size' ... matched as AVOption 'hls_list_size' with argument '10'. Reading option '-var_stream_map' ... matched as AVOption 'var_stream_map' with argument 'v:0,a:0 v:1,a:1'. Reading option '-master_pl_publish_rate' ... matched as AVOption 'master_pl_publish_rate' with argument '10'. Reading option '-master_pl_name' ... matched as AVOption 'master_pl_name' with argument 'master.m3u8'. Reading option '-hls_segment_type' ... matched as AVOption 'hls_segment_type' with argument '1'. Reading option '-hls_key_info_file' ... matched as AVOption 'hls_key_info_file' with argument '/home/lin/Desktop/src/test.keyinfo'. Reading option '/home/lin/Desktop/dest/vs%v/manifest.m3u8' ... matched as output url. Finished splitting the commandline. Parsing a group of options: global . Applying option loglevel (set logging level) with argument debug. Applying option init_hw_device (initialise hardware device) with argument cuda=cuda. [AVHWDeviceContext @ 0x415a500] Loaded lib: libcuda.so.1 [AVHWDeviceContext @ 0x415a500] Loaded sym: cuInit [AVHWDeviceContext @ 0x415a500] Loaded sym: cuDeviceGetCount [AVHWDeviceContext @ 0x415a500] Loaded sym: cuDeviceGet [AVHWDeviceContext @ 0x415a500] Loaded sym: cuDeviceGetName [AVHWDeviceContext @ 0x415a500] Loaded sym: cuDeviceComputeCapability [AVHWDeviceContext @ 0x415a500] Loaded sym: cuCtxCreate_v2 [AVHWDeviceContext @ 0x415a500] Loaded sym: cuCtxSetLimit [AVHWDeviceContext @ 0x415a500] Loaded sym: cuCtxPushCurrent_v2 [AVHWDeviceContext @ 0x415a500] Loaded sym: cuCtxPopCurrent_v2 [AVHWDeviceContext @ 0x415a500] Loaded sym: cuCtxDestroy_v2 [AVHWDeviceContext @ 0x415a500] Loaded sym: cuMemAlloc_v2 [AVHWDeviceContext @ 0x415a500] Loaded sym: cuMemFree_v2 [AVHWDeviceContext @ 0x415a500] Loaded sym: cuMemcpy2D_v2 [AVHWDeviceContext @ 0x415a500] Loaded sym: cuGetErrorName [AVHWDeviceContext @ 0x415a500] Loaded sym: cuGetErrorString Applying option filter_hw_device (set hardware device used when filtering) with argument cuda. Applying option filter_complex_threads (number of threads for -filter_complex) with argument 4. Applying option vsync (video sync method) with argument 1. Applying option filter_complex (create a complex filtergraph) with argument ['v:0']split=2[s0][s1]; [s0]hwupload,scale_npp=w=1920:h=1080:interp_algo=lanczos:format=yuv420p[v0]; [s1]hwupload,scale_npp=w=1280:h=720:interp_algo=lanczos:format=yuv420p[v1]. Successfully parsed a group of options. Parsing a group of options: input url /home/lin/Desktop/src/sowdtow.webm. Applying option stream_loop (set number of times input stream shall be looped) with argument -1. Applying option hwaccel (use HW accelerated decoding) with argument cuda. Successfully parsed a group of options. Opening an input file: /home/lin/Desktop/src/sowdtow.webm. [NULL @ 0x4859680] Opening '/home/lin/Desktop/src/sowdtow.webm' for reading [file @ 0x4859e80] Setting default whitelist 'file,crypto' [matroska,webm @ 0x4859680] Format matroska,webm probed with size=2048 and score=100 st:0 removing common factor 1000000 from timebase st:1 removing common factor 1000000 from timebase [matroska,webm @ 0x4859680] Before avformat_find_stream_info() pos: 810 bytes read:32768 seeks:0 nb_streams:2 [vp9 @ 0x485ca80] Format yuv420p chosen by get_format(). [matroska,webm @ 0x4859680] All info found [matroska,webm @ 0x4859680] After avformat_find_stream_info() pos: 1995 bytes read:32768 seeks:0 frames:2 Input #0, matroska,webm, from '/home/lin/Desktop/src/sowdtow.webm': Metadata: ENCODER : Lavf58.10.100 Duration: 00:03:02.18, start: 0.000000, bitrate: 16906 kb/s Stream #0:0(eng), 1, 1/1000: Video: vp9 (Profile 0), 1 reference frame, yuv420p(tv, bt709/unknown/unknown), 3840x2160, 0/1, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default) Metadata: DURATION : 00:03:02.115000000 Stream #0:1, 1, 1/1000: Audio: aac (LC), 44100 Hz, stereo, fltp (default) Metadata: HANDLER_NAME : SoundHandler DURATION : 00:03:02.184000000 Successfully opened the file. [Parsed_split_0 @ 0x486ed80] Setting 'outputs' to value '2' [Parsed_scale_npp_2 @ 0x48ff880] Setting 'w' to value '1920' [Parsed_scale_npp_2 @ 0x48ff880] Setting 'h' to value '1080' [Parsed_scale_npp_2 @ 0x48ff880] Setting 'interp_algo' to value 'lanczos' [Parsed_scale_npp_2 @ 0x48ff880] Setting 'format' to value 'yuv420p' [Parsed_scale_npp_4 @ 0x4901900] Setting 'w' to value '1280' [Parsed_scale_npp_4 @ 0x4901900] Setting 'h' to value '720' [Parsed_scale_npp_4 @ 0x4901900] Setting 'interp_algo' to value 'lanczos' [Parsed_scale_npp_4 @ 0x4901900] Setting 'format' to value 'yuv420p' Parsing a group of options: output url /home/lin/Desktop/dest/vs%v/manifest.m3u8. Applying option b:v:0 (video bitrate (please use -b:v)) with argument 4388k. Applying option c:v (codec name) with argument hevc_nvenc. Applying option profile:v (set profile) with argument main. Applying option b:v:1 (video bitrate (please use -b:v)) with argument 3413k. Applying option c:v (codec name) with argument hevc_nvenc. Applying option profile:v (set profile) with argument main. Applying option b:a:0 (video bitrate (please use -b:v)) with argument 256k. Applying option b:a:1 (video bitrate (please use -b:v)) with argument 192k. Applying option c:a (codec name) with argument aac. Applying option ar (set audio sampling rate (in Hz)) with argument 48000. Applying option bsf:a (A comma-separated list of bitstream filters) with argument aac_adtstoasc. Applying option map (set input stream mapping) with argument [v0]. Applying option map (set input stream mapping) with argument [v1]. Applying option map (set input stream mapping) with argument 0:a:0. Last message repeated 1 times Applying option f (force format) with argument hls. Successfully parsed a group of options. Opening an output file: /home/lin/Desktop/dest/vs%v/manifest.m3u8. Successfully opened the file. Stream mapping: Stream #0:0 (vp9) -> split (graph 0) scale_npp (graph 0) -> Stream #0:0 (hevc_nvenc) scale_npp (graph 0) -> Stream #0:1 (hevc_nvenc) Stream #0:1 -> #0:2 (aac (native) -> aac (native)) Stream #0:1 -> #0:3 (aac (native) -> aac (native)) Press [q] to stop, [?] for help cur_dts is invalid (this is harmless if it occurs once at the start per stream) Last message repeated 1 times [vp9 @ 0x4909bc0] Format cuda chosen by get_format(). [vp9 @ 0x4909bc0] Format cuda requires hwaccel initialisation. detected 8 logical cores [graph_1_in_0_1 @ 0x48d9f00] Setting 'time_base' to value '1/44100' [graph_1_in_0_1 @ 0x48d9f00] Setting 'sample_rate' to value '44100' [graph_1_in_0_1 @ 0x48d9f00] Setting 'sample_fmt' to value 'fltp' [graph_1_in_0_1 @ 0x48d9f00] Setting 'channel_layout' to value '0x3' [graph_1_in_0_1 @ 0x48d9f00] tb:1/44100 samplefmt:fltp samplerate:44100 chlayout:0x3 [format_out_0_2 @ 0x48da280] Setting 'sample_fmts' to value 'fltp' [format_out_0_2 @ 0x48da280] Setting 'sample_rates' to value '48000' [format_out_0_2 @ 0x48da280] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_2' [AVFilterGraph @ 0x4903140] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed [auto_resampler_0 @ 0x48db7c0] [SWR @ 0x48dbc80] Using fltp internally between filters [auto_resampler_0 @ 0x48db7c0] ch:2 chl:stereo fmt:fltp r:44100Hz -> ch:2 chl:stereo fmt:fltp r:48000Hz [graph_2_in_0_1 @ 0x4b4e700] Setting 'time_base' to value '1/44100' [graph_2_in_0_1 @ 0x4b4e700] Setting 'sample_rate' to value '44100' [graph_2_in_0_1 @ 0x4b4e700] Setting 'sample_fmt' to value 'fltp' [graph_2_in_0_1 @ 0x4b4e700] Setting 'channel_layout' to value '0x3' [graph_2_in_0_1 @ 0x4b4e700] tb:1/44100 samplefmt:fltp samplerate:44100 chlayout:0x3 [format_out_0_3 @ 0x4b4f380] Setting 'sample_fmts' to value 'fltp' [format_out_0_3 @ 0x4b4f380] Setting 'sample_rates' to value '48000' [vp9 @ 0x4909bc0] Loaded lib: libnvcuvid.so.1 [vp9 @ 0x4909bc0] Loaded sym: cuvidGetDecoderCaps [vp9 @ 0x4909bc0] Loaded sym: cuvidCreateDecoder [vp9 @ 0x4909bc0] Loaded sym: cuvidDestroyDecoder [vp9 @ 0x4909bc0] Loaded sym: cuvidDecodePicture [vp9 @ 0x4909bc0] Loaded sym: cuvidMapVideoFrame64 [vp9 @ 0x4909bc0] Loaded sym: cuvidUnmapVideoFrame64 [vp9 @ 0x4909bc0] Loaded sym: cuvidCtxLockCreate [format_out_0_3 @ 0x4b4f380] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_3' [vp9 @ 0x4909bc0] Loaded sym: cuvidCtxLockDestroy [vp9 @ 0x4909bc0] Loaded sym: cuvidCtxLock [vp9 @ 0x4909bc0] Loaded sym: cuvidCtxUnlock [vp9 @ 0x4909bc0] Loaded sym: cuvidCreateVideoSource [vp9 @ 0x4909bc0] Loaded sym: cuvidCreateVideoSourceW [vp9 @ 0x4909bc0] Loaded sym: cuvidDestroyVideoSource [vp9 @ 0x4909bc0] Loaded sym: cuvidSetVideoSourceState [vp9 @ 0x4909bc0] Loaded sym: cuvidGetVideoSourceState [AVFilterGraph @ 0x48ff5c0] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed [vp9 @ 0x4909bc0] Loaded sym: cuvidGetSourceVideoFormat [vp9 @ 0x4909bc0] Loaded sym: cuvidGetSourceAudioFormat [vp9 @ 0x4909bc0] Loaded sym: cuvidCreateVideoParser [vp9 @ 0x4909bc0] Loaded sym: cuvidParseVideoData [vp9 @ 0x4909bc0] Loaded sym: cuvidDestroyVideoParser [auto_resampler_0 @ 0x4b50340] [SWR @ 0x4b507c0] Using fltp internally between filters [auto_resampler_0 @ 0x4b50340] ch:2 chl:stereo fmt:fltp r:44100Hz -> ch:2 chl:stereo fmt:fltp r:48000Hz cur_dts is invalid (this is harmless if it occurs once at the start per stream) Last message repeated 1 times [vp9 @ 0x4909bc0] NVDEC capabilities: [vp9 @ 0x4909bc0] format supported: yes, max_mb_count: 262144 [vp9 @ 0x4909bc0] min_width: 144, max_width: 8192 [vp9 @ 0x4909bc0] min_height: 144, max_height: 8192 cur_dts is invalid (this is harmless if it occurs once at the start per stream) Last message repeated 1 times [Parsed_split_0 @ 0x4b6b700] Setting 'outputs' to value '2' [Parsed_scale_npp_2 @ 0x4b6be80] Setting 'w' to value '1920' [Parsed_scale_npp_2 @ 0x4b6be80] Setting 'h' to value '1080' [Parsed_scale_npp_2 @ 0x4b6be80] Setting 'interp_algo' to value 'lanczos' [Parsed_scale_npp_2 @ 0x4b6be80] Setting 'format' to value 'yuv420p' [Parsed_scale_npp_4 @ 0x5429300] Setting 'w' to value '1280' [Parsed_scale_npp_4 @ 0x5429300] Setting 'h' to value '720' [Parsed_scale_npp_4 @ 0x5429300] Setting 'interp_algo' to value 'lanczos' [Parsed_scale_npp_4 @ 0x5429300] Setting 'format' to value 'yuv420p' [graph 0 input from stream 0:0 @ 0x542adc0] Setting 'video_size' to value '3840x2160' [graph 0 input from stream 0:0 @ 0x542adc0] Setting 'pix_fmt' to value '23' [graph 0 input from stream 0:0 @ 0x542adc0] Setting 'time_base' to value '1/1000' [graph 0 input from stream 0:0 @ 0x542adc0] Setting 'pixel_aspect' to value '1/1' [graph 0 input from stream 0:0 @ 0x542adc0] Setting 'sws_param' to value 'flags=2' [graph 0 input from stream 0:0 @ 0x542adc0] Setting 'frame_rate' to value '30000/1001' [graph 0 input from stream 0:0 @ 0x542adc0] w:3840 h:2160 pixfmt:nv12 tb:1/1000 fr:30000/1001 sar:1/1 sws_param:flags=2 [format @ 0x5429c80] Setting 'pix_fmts' to value 'yuv420p|nv12|p010le|yuv444p|p016le|yuv444p16le|bgr0|rgb0|cuda' [format @ 0x48fc800] Setting 'pix_fmts' to value 'yuv420p|nv12|p010le|yuv444p|p016le|yuv444p16le|bgr0|rgb0|cuda' [AVFilterGraph @ 0x4b6c880] query_formats: 10 queried, 9 merged, 0 already done, 0 delayed [hwupload @ 0x56c3040] Surface format is nv12. [Parsed_scale_npp_4 @ 0x5429300] w:3840 h:2160 -> w:1280 h:720 [hwupload @ 0x4c15540] Surface format is nv12. [Parsed_scale_npp_2 @ 0x4b6be80] w:3840 h:2160 -> w:1920 h:1080 [hevc_nvenc @ 0x49032c0] Loaded lib: libcuda.so.1 [hevc_nvenc @ 0x49032c0] Loaded sym: cuInit [hevc_nvenc @ 0x49032c0] Loaded sym: cuDeviceGetCount [hevc_nvenc @ 0x49032c0] Loaded sym: cuDeviceGet [hevc_nvenc @ 0x49032c0] Loaded sym: cuDeviceGetName [hevc_nvenc @ 0x49032c0] Loaded sym: cuDeviceComputeCapability [hevc_nvenc @ 0x49032c0] Loaded sym: cuCtxCreate_v2 [hevc_nvenc @ 0x49032c0] Loaded sym: cuCtxSetLimit [hevc_nvenc @ 0x49032c0] Loaded sym: cuCtxPushCurrent_v2 [hevc_nvenc @ 0x49032c0] Loaded sym: cuCtxPopCurrent_v2 [hevc_nvenc @ 0x49032c0] Loaded sym: cuCtxDestroy_v2 [hevc_nvenc @ 0x49032c0] Loaded sym: cuMemAlloc_v2 [hevc_nvenc @ 0x49032c0] Loaded sym: cuMemFree_v2 [hevc_nvenc @ 0x49032c0] Loaded sym: cuMemcpy2D_v2 [hevc_nvenc @ 0x49032c0] Loaded sym: cuGetErrorName [hevc_nvenc @ 0x49032c0] Loaded sym: cuGetErrorString [hevc_nvenc @ 0x49032c0] Loaded lib: libnvidia-encode.so.1 [hevc_nvenc @ 0x49032c0] Loaded sym: NvEncodeAPICreateInstance [hevc_nvenc @ 0x49032c0] Loaded sym: NvEncodeAPIGetMaxSupportedVersion [hevc_nvenc @ 0x49032c0] Loaded Nvenc version 8.1 [hevc_nvenc @ 0x49032c0] Nvenc initialized successfully Clipping frame in rate conversion by 0.000008 [hevc_nvenc @ 0x4904040] Loaded lib: libcuda.so.1 [hevc_nvenc @ 0x4904040] Loaded sym: cuInit [hevc_nvenc @ 0x4904040] Loaded sym: cuDeviceGetCount [hevc_nvenc @ 0x4904040] Loaded sym: cuDeviceGet [hevc_nvenc @ 0x4904040] Loaded sym: cuDeviceGetName [hevc_nvenc @ 0x4904040] Loaded sym: cuDeviceComputeCapability [hevc_nvenc @ 0x4904040] Loaded sym: cuCtxCreate_v2 [hevc_nvenc @ 0x4904040] Loaded sym: cuCtxSetLimit [hevc_nvenc @ 0x4904040] Loaded sym: cuCtxPushCurrent_v2 [hevc_nvenc @ 0x4904040] Loaded sym: cuCtxPopCurrent_v2 [hevc_nvenc @ 0x4904040] Loaded sym: cuCtxDestroy_v2 [hevc_nvenc @ 0x4904040] Loaded sym: cuMemAlloc_v2 [hevc_nvenc @ 0x4904040] Loaded sym: cuMemFree_v2 [hevc_nvenc @ 0x4904040] Loaded sym: cuMemcpy2D_v2 [hevc_nvenc @ 0x4904040] Loaded sym: cuGetErrorName [hevc_nvenc @ 0x4904040] Loaded sym: cuGetErrorString [hevc_nvenc @ 0x4904040] Loaded lib: libnvidia-encode.so.1 [hevc_nvenc @ 0x4904040] Loaded sym: NvEncodeAPICreateInstance [hevc_nvenc @ 0x4904040] Loaded sym: NvEncodeAPIGetMaxSupportedVersion [hevc_nvenc @ 0x4904040] Loaded Nvenc version 8.1 [hevc_nvenc @ 0x4904040] Nvenc initialized successfully [hls @ 0x4901e80] Number of variant streams 2 [hls @ 0x4901e80] Opening '/home/lin/Desktop/dest/vs0/init_0.mp4' for writing [file @ 0x5837640] Setting default whitelist 'file,crypto' [hls @ 0x4901e80] Opening '/home/lin/Desktop/src/test.keyinfo' for reading [file @ 0x5878c80] Setting default whitelist 'file,crypto' [AVIOContext @ 0x5880f40] Statistics: 93 bytes read, 0 seeks [hls @ 0x4901e80] Opening '/home/lin/Desktop/src/enc.key' for reading [file @ 0x5878ec0] Setting default whitelist 'file,crypto' [AVIOContext @ 0x5878d00] Statistics: 16 bytes read, 0 seeks [hls @ 0x4901e80] Opening 'crypto:/home/lin/Desktop/dest/vs0/manifest0.m4s' for writing [crypto @ 0x5878f80] No default whitelist set [file @ 0x587b580] Setting default whitelist 'file,crypto' [hls @ 0x4901e80] Opening '/home/lin/Desktop/dest/vs1/init_1.mp4' for writing [file @ 0x5886600] Setting default whitelist 'file,crypto' [hls @ 0x4901e80] Opening 'crypto:/home/lin/Desktop/dest/vs1/manifest0.m4s' for writing [crypto @ 0x58c7b40] No default whitelist set [file @ 0x58c9e80] Setting default whitelist 'file,crypto' Output #0, hls, to '/home/lin/Desktop/dest/vs%v/manifest.m3u8': Metadata: encoder : Lavf58.11.101 Stream #0:0, 0, 1/30000: Video: hevc (hevc_nvenc) (Main), 1 reference frame, cuda(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 0/1, q=-1--1, 4388 kb/s, 29.97 fps, 30k tbn, 29.97 tbc (default) Metadata: encoder : Lavc58.17.100 hevc_nvenc Side data: cpb: bitrate max/min/avg: 0/0/4388000 buffer size: 8776000 vbv_delay: -1 Stream #0:1, 0, 1/30000: Video: hevc (hevc_nvenc) (Main), 1 reference frame, cuda, 1280x720 [SAR 1:1 DAR 16:9], 0/1, q=-1--1, 3413 kb/s, 29.97 fps, 30k tbn, 29.97 tbc (default) Metadata: encoder : Lavc58.17.100 hevc_nvenc Side data: cpb: bitrate max/min/avg: 0/0/3413000 buffer size: 6826000 vbv_delay: -1 Stream #0:2, 0, 1/48000: Audio: aac (LC), 48000 Hz, stereo, fltp, delay 1024, 256 kb/s (default) Metadata: HANDLER_NAME : SoundHandler DURATION : 00:03:02.184000000 encoder : Lavc58.17.100 aac Stream #0:3, 0, 1/48000: Audio: aac (LC), 48000 Hz, stereo, fltp, delay 1024, 192 kb/s (default) Metadata: HANDLER_NAME : SoundHandler DURATION : 00:03:02.184000000 encoder : Lavc58.17.100 aac Clipping frame in rate conversion by 0.000008 cur_dts is invalid (this is harmless if it occurs once at the start per stream) Last message repeated 9 times Clipping frame in rate conversion by 0.010979 Last message repeated 1 times cur_dts is invalid (this is harmless if it occurs once at the start per stream) Last message repeated 5 times Clipping frame in rate conversion by 0.002983 Last message repeated 1 times Clipping frame in rate conversion by 0.013969 Last message repeated 1 times Clipping frame in rate conversion by 0.005974 Last message repeated 1 times Clipping frame in rate conversion by 0.008995 Last message repeated 1 times Clipping frame in rate conversion by 0.000999 Last message repeated 1 times Clipping frame in rate conversion by 0.011986 Last message repeated 1 times Clipping frame in rate conversion by 0.003990 Last message repeated 1 times Clipping frame in rate conversion by 0.006981 Last message repeated 1 times Clipping frame in rate conversion by 0.009972 Last message repeated 1 times Clipping frame in rate conversion by 0.001976 Last message repeated 1 times Clipping frame in rate conversion by 0.012993 Last message repeated 1 times Clipping frame in rate conversion by 0.004997 Last message repeated 1 times Clipping frame in rate conversion by 0.007988 Last message repeated 1 times Clipping frame in rate conversion by 0.010979 Last message repeated 1 times Clipping frame in rate conversion by 0.002983 Last message repeated 1 times Clipping frame in rate conversion by 0.013969 Last message repeated 1 times Clipping frame in rate conversion by 0.005974 Last message repeated 1 times Clipping frame in rate conversion by 0.008995 Last message repeated 1 times Clipping frame in rate conversion by 0.000999 Last message repeated 1 times Clipping frame in rate conversion by 0.011986 Last message repeated 1 times Clipping frame in rate conversion by 0.003990 Last message repeated 1 times Clipping frame in rate conversion by 0.006981me=00:00:01.57 bitrate=N/A speed= 3.1x Last message repeated 1 times Clipping frame in rate conversion by 0.009972 Last message repeated 1 times Clipping frame in rate conversion by 0.001976 Last message repeated 1 times Clipping frame in rate conversion by 0.012993 Last message repeated 1 times Clipping frame in rate conversion by 0.004997 Last message repeated 1 times Clipping frame in rate conversion by 0.007988 Last message repeated 1 times Clipping frame in rate conversion by 0.010979 Last message repeated 1 times Clipping frame in rate conversion by 0.002983 Last message repeated 1 times Clipping frame in rate conversion by 0.013969 Last message repeated 1 times Clipping frame in rate conversion by 0.005974 Last message repeated 1 times Clipping frame in rate conversion by 0.008995 Last message repeated 1 times Clipping frame in rate conversion by 0.000999 Last message repeated 1 times Clipping frame in rate conversion by 0.011986 Last message repeated 1 times Clipping frame in rate conversion by 0.003990 Last message repeated 1 times Clipping frame in rate conversion by 0.006981 Last message repeated 1 times Clipping frame in rate conversion by 0.009972 Last message repeated 1 times Clipping frame in rate conversion by 0.001976 Last message repeated 1 times Clipping frame in rate conversion by 0.012993 Last message repeated 1 times Clipping frame in rate conversion by 0.004997 Last message repeated 1 times Clipping frame in rate conversion by 0.007988 Last message repeated 1 times Clipping frame in rate conversion by 0.010979 Last message repeated 1 times Clipping frame in rate conversion by 0.002983 Last message repeated 1 times Clipping frame in rate conversion by 0.013969 Last message repeated 1 times Clipping frame in rate conversion by 0.005974 Last message repeated 1 times Clipping frame in rate conversion by 0.008995 Last message repeated 1 times Clipping frame in rate conversion by 0.000999 Last message repeated 1 times Clipping frame in rate conversion by 0.011986 Last message repeated 1 times Clipping frame in rate conversion by 0.003990me=00:00:03.47 bitrate=N/A speed=3.44x Last message repeated 1 times Clipping frame in rate conversion by 0.006981 Last message repeated 1 times Clipping frame in rate conversion by 0.009972 Last message repeated 1 times Clipping frame in rate conversion by 0.001976 Last message repeated 1 times Clipping frame in rate conversion by 0.012993 Last message repeated 1 times Clipping frame in rate conversion by 0.004997 Last message repeated 1 times Clipping frame in rate conversion by 0.007988 Last message repeated 1 times Clipping frame in rate conversion by 0.010979 Last message repeated 1 times Clipping frame in rate conversion by 0.002983 Last message repeated 1 times Clipping frame in rate conversion by 0.013969 Last message repeated 1 times Clipping frame in rate conversion by 0.005974 Last message repeated 1 times Clipping frame in rate conversion by 0.008995 Last message repeated 1 times Clipping frame in rate conversion by 0.000999 Last message repeated 1 times Clipping frame in rate conversion by 0.011986 Last message repeated 1 times Clipping frame in rate conversion by 0.003990 Last message repeated 1 times Clipping frame in rate conversion by 0.006981 Last message repeated 1 times Clipping frame in rate conversion by 0.009972 Last message repeated 1 times Clipping frame in rate conversion by 0.001976 Last message repeated 1 times Clipping frame in rate conversion by 0.012993 Last message repeated 1 times Clipping frame in rate conversion by 0.004997 Last message repeated 1 times Clipping frame in rate conversion by 0.007988 Last message repeated 1 times Clipping frame in rate conversion by 0.010979 Last message repeated 1 times Clipping frame in rate conversion by 0.002983 Last message repeated 1 times Clipping frame in rate conversion by 0.013969 Last message repeated 1 times Clipping frame in rate conversion by 0.005974 Last message repeated 1 times Clipping frame in rate conversion by 0.008995me=00:00:05.29 bitrate=N/A speed=3.49x Last message repeated 1 times Clipping frame in rate conversion by 0.000999 Last message repeated 1 times Clipping frame in rate conversion by 0.003990 Last message repeated 1 times Clipping frame in rate conversion by 0.001976 Last message repeated 1 times Clipping frame in rate conversion by 0.002983 Last message repeated 1 times Clipping frame in rate conversion by 0.000999 Last message repeated 1 times Clipping frame in rate conversion by 0.003990 Last message repeated 1 times Clipping frame in rate conversion by 0.001976 Last message repeated 1 times Clipping frame in rate conversion by 0.002983me=00:00:06.95 bitrate=N/A speed=3.43x Last message repeated 1 times Clipping frame in rate conversion by 0.000999 Last message repeated 1 times Clipping frame in rate conversion by 0.003990 Last message repeated 1 times Clipping frame in rate conversion by 0.001976 Last message repeated 1 times Clipping frame in rate conversion by 0.002983 Last message repeated 1 times Clipping frame in rate conversion by 0.000999 Last message repeated 1 times Clipping frame in rate conversion by 0.003990 Last message repeated 1 times Clipping frame in rate conversion by 0.001976me=00:00:08.57 bitrate=N/A speed=3.39x Last message repeated 1 times Clipping frame in rate conversion by 0.002983 Last message repeated 1 times Clipping frame in rate conversion by 0.000999 Last message repeated 1 times Clipping frame in rate conversion by 0.003990 Last message repeated 1 times Clipping frame in rate conversion by 0.001976 Last message repeated 1 times [AVIOContext @ 0x5877840] Statistics: 0 seeks, 0 writeouts [hls @ 0x4901e80] Opening '/home/lin/Desktop/dest/vs0/manifest0.m4s' for writing [file @ 0x5932500] Setting default whitelist 'file,crypto' [AVIOContext @ 0x5937e80] Statistics: 0 seeks, 23 writeouts [hls @ 0x4901e80] Opening 'crypto:/home/lin/Desktop/dest/vs0/manifest1.m4s' for writing [crypto @ 0x5a6f3c0] No default whitelist set [file @ 0x4db9480] Setting default whitelist 'file,crypto' [hls @ 0x4901e80] Opening '/home/lin/Desktop/dest/vs0/manifest.m3u8.tmp' for writing [file @ 0x591aa80] Setting default whitelist 'file,crypto' EXT-X-MEDIA-SEQUENCE:0 [AVIOContext @ 0x5937e80] Statistics: 0 seeks, 1 writeouts Clipping frame in rate conversion by 0.002983 [AVIOContext @ 0x58c6740] Statistics: 0 seeks, 0 writeouts [hls @ 0x4901e80] Opening '/home/lin/Desktop/dest/vs1/manifest0.m4s' for writing [file @ 0x5abd780] Setting default whitelist 'file,crypto' [AVIOContext @ 0x53ceb00] Statistics: 0 seeks, 19 writeouts [hls @ 0x4901e80] Opening 'crypto:/home/lin/Desktop/dest/vs1/manifest1.m4s' for writing [crypto @ 0x5932500] No default whitelist set [file @ 0x591aa80] Setting default whitelist 'file,crypto' [hls @ 0x4901e80] Opening '/home/lin/Desktop/dest/vs1/manifest.m3u8.tmp' for writing [file @ 0x593a440] Setting default whitelist 'file,crypto' EXT-X-MEDIA-SEQUENCE:0 [AVIOContext @ 0x4dba0c0] Statistics: 0 seeks, 1 writeouts [hls @ 0x4901e80] Opening '/home/lin/Desktop/dest/master.m3u8' for writing [file @ 0x4b6cb00] Setting default whitelist 'file,crypto' [AVIOContext @ 0x5938cc0] Statistics: 0 seeks, 1 writeouts Clipping frame in rate conversion by 0.002983 [hls @ 0x4901e80] Opening '/home/lin/Desktop/dest/vs0/manifest1.m4s' for writing [file @ 0x5abd780] Setting default whitelist 'file,crypto' Segmentation fault (core dumped)
According to dmesg, here's what causes the crash:
[ 7722.376375] ffmpeg[22115]: segfault at 48 ip 00007ffa0f67e08c sp 00007ffcaef97260 error 4 in libc-2.23.so[7ffa0f5f9000+1c0000] [ 7955.317211] ffmpeg[24384]: segfault at 40c6 ip 00007efe6959808c sp 00007ffc01754400 error 4 in libc-2.23.so[7efe69513000+1c0000] [ 7974.490782] ffmpeg[24597]: segfault at 211 ip 00007f86b221e08c sp 00007ffeefc30a70 error 4 in libc-2.23.so[7f86b2199000+1c0000]
Build configuration:
ffmpeg -buildconf ffmpeg version N-90652-g2108a67 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609 configuration: --pkg-config-flags=--static --prefix=/home/lin/bin --bindir=/home/lin/bin --extra-cflags=-I/home/lin/bin/include --extra-ldflags=-L/home/lin/bin/lib --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --enable-cuda-sdk --enable-cuvid --enable-libnpp --extra-cflags=-I../nv_sdk --extra-ldflags=-L../nv_sdk --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/ --enable-nvenc --nvccflags='-gencode arch=compute_61,code=sm_61 -O2' --enable-vaapi --disable-debug --enable-libvorbis --enable-libvpx --enable-libdrm --enable-gpl --cpu=native --enable-opengl --enable-libfdk-aac --enable-libx264 --enable-libx265 --extra-libs=-lpthread --enable-nonfree libavutil 56. 13.100 / 56. 13.100 libavcodec 58. 17.100 / 58. 17.100 libavformat 58. 11.101 / 58. 11.101 libavdevice 58. 2.100 / 58. 2.100 libavfilter 7. 14.100 / 7. 14.100 libswscale 5. 0.102 / 5. 0.102 libswresample 3. 0.101 / 3. 0.101 libpostproc 55. 0.100 / 55. 0.100 configuration: --pkg-config-flags=--static --prefix=/home/lin/bin --bindir=/home/lin/bin --extra-cflags=-I/home/lin/bin/include --extra-ldflags=-L/home/lin/bin/lib --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --enable-cuda-sdk --enable-cuvid --enable-libnpp --extra-cflags=-I../nv_sdk --extra-ldflags=-L../nv_sdk --extra-cflags=-I/usr/local/cuda/include/ --extra-ldflags=-L/usr/local/cuda/lib64/ --enable-nvenc --nvccflags='-gencode arch=compute_61,code=sm_61 -O2' --enable-vaapi --disable-debug --enable-libvorbis --enable-libvpx --enable-libdrm --enable-gpl --cpu=native --enable-opengl --enable-libfdk-aac --enable-libx264 --enable-libx265 --extra-libs=-lpthread --enable-nonfree
Change History (8)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Alright, here is a simplified command, adjust paths as needed:
ffmpeg -f lavfi -i color=red -f lavfi -i anullsrc -g 29.97 -r 29.97 -b:v:0 1000k -b:v:1 256k -b:a:1 64k -b:a:1 32k -map 0:v -map 1:a -map 0:v -map 1:a -f hls -var_stream_map "v:0,a:0 v:1,a:1" -master_pl_name master.m3u8 -t 360 -hls_time 2 -hls_segment_type 1 -hls_key_info_file /crypt/channel/secrets.keyinfo /web/cdn/vs%v/output_sl.m3u8
comment:3 by , 7 years ago
Priority: | normal → important |
---|
There are so many issues here including buffer overwrite, use-after-free and leaks that I don’t know where to start bisecting and debugging.
comment:4 by , 7 years ago
ffmpeg have not support encrypt fmp4 in hls now, it have little different implementation way with mpegts, so need more time.
comment:6 by , 7 years ago
Hello @stephen, if you have patches for this, I'm willing to be a beta tester. Anytime.
comment:7 by , 5 years ago
@stevenliu When using ffmpeg version 3.4.6-0ubuntu0.18.04.1, I seem to be able to successfully output encrypted fmp4, but there is one small problem: the init.mp4 gets saved to the base directory instead of alongside the desired .m3u8 file (in a subfolder).
So I then upgraded my ffmpeg to ffmpeg version 4.2.2-0york0~18.04 to see if the bug was fixed. The good news is that 4.2.2 seems to save the init.mp4 file to the correct subfolder.
However, the process fails and throws this error:
writing [hls @ 0x562c38c44c40] Encrypted fmp4 not yet supported Could not write header for output file #0 (incorrect codec parameters ?): Not yet implemented in FFmpeg, patches welcome Error initializing output stream 0:1 -- [aac @ 0x562c38ca7940] Qavg: -nan Conversion failed!
Is my understanding correct that ffmpeg supported encrypting fmp4 back in version 3.4.6 but by 4.2.2 dropped support for it?
(I wish I could find a version of ffmpeg that supports encrypting fmp4 and saves the init.mp4 in the same subfolder as the m3u8.)
Thanks!
comment:8 by , 5 years ago
I suppose it is not real encrypted fmp4... https://patchwork.ffmpeg.org/project/ffmpeg/patch/20180416062230.2892-1-lq@chinaffmpeg.org/
Please either provide a simplified command line that others can test or provide backtrace etc. as explained on https://ffmpeg.org/bugreports.html