-
Notifications
You must be signed in to change notification settings - Fork 417
Description
Overview
I have been able to generate single bit rate (default) with PyAV. My options dict is as follows:
HLS_MANIFEST = "/home/www/whatever/whatever.m3u8"
HLS_OPTS = {'hls_playlist_type': 'vod', 'hls_list_size': '3', 'hls_time': '2', 'hls_segment_type': 'mpegts', 'hls_flags': 'delete_segments+discont_start', 'hls_start_number_source': 'datetime', 'strftime': '1', 'use_localtime': '1', 'hls_segment_filename': '/home/www/whatever/data%02d.ts'}
self.__container = av.open(HLS_MANIFEST,
options=HLS_OPTS,
mode='w',
format='hls')
...by providing 2 add_stream one for video and one for audio with threading. It generated nicely .m3u8 file and bunch of segments and VLC client can stream just fine.
Expected behavior
It should work with multi bit rate I could hope ! But it did not.
Actual behavior
But with multi bit rate no file (nothing actually) were generated. My option dict is as follows:
HLS_MANIFEST = "/home/www/whatever/whatever.m3u8"
HLS_OPTS ={'filter_complex': '[0:v]split=3[v1][v2][v3]; [v1]copy[v1out]; [v2]scale=w=1280:h=720[v2out]; [v3]scale=w=640:h=360[v3out] -preset veryfast -g 25 -sc_threshold 0 -map [v1out] -c:v:0 libx264 -x264-params “nal-hrd=cbr:force-cfr=1” -b:v:0 5M -maxrate:v:0 5M -minrate:v:0 5M -bufsize:v:0 10M -preset slow -g 48 -sc_threshold 0 -keyint_min 48 -map [v2out] -c:v:1 libx264 -x264-params “nal-hrd=cbr:force-cfr=1” -b:v:1 3M -maxrate:v:1 3M -minrate:v:1 3M -bufsize:v:1 3M -preset slow -g 48 -sc_threshold 0 -keyint_min 48 -map [v3out] -c:v:2 libx264 -x264-params “nal-hrd=cbr:force-cfr=1” -b:v:2 1M -maxrate:v:2 1M -minrate:v:2 1M -bufsize:v:2 1M -preset slow -g 48\n -map a:0 -c:a:0 aac -b:a:0 96k -ac 2 -map a:0 -c:a:1 aac -b:a:1 128k -ac 2 -map a:0 -c:a:2 aac -b:a:2 48k -ac 2 ', 'hls_time': '4', 'hls_playlist_type': 'vod', 'hls_flags': 'independent_segments', 'f': 'hls', 'use_localtime_mkdir': '1', 'hls_segment_filename': '/home/www/whatever/stream_%v/data%06d.ts', 'master_pl_name': '/home/www/whatever/whatever.m3u8', 'var_stream_map': '"v:0,a:0 v:1,a:1 v:2,a:2" /home/www/whatever/stream_%v/stream.m3u8'}
I have tried hls_playlist_type as vod - live event without success.
Investigation
I could not see any file generated when started!
Reproduction
It can always be reproduced.
Versions
- OS: {{Ubuntu 18.04}}
- PyAV runtime:
{{ PyAV v8.0.3
git origin: git@github.com:PyAV-Org/PyAV
git commit: v8.0.3
library configuration: --disable-doc --disable-static --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-shared --enable-version3 --enable-zlib --prefix=/tmp/vendor
library license: GPL version 3 or later
libavcodec 58. 91.100
libavdevice 58. 10.100
libavfilter 7. 85.100
libavformat 58. 45.100
libavutil 56. 51.100
libswresample 3. 7.100
libswscale 5. 7.100 }}
- PyAV build:
{{ Complete output of `python setup.py config --verbose`. }}
- FFmpeg:
{{ ffmpeg version N-104475-g1728127 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 5.5.0 (Ubuntu 5.5.0-12ubuntu1~16.04) 20171010
configuration: --enable-nonfree --enable-cuda-nvcc
libavutil 57. 7.100 / 57. 7.100
libavcodec 59. 12.100 / 59. 12.100
libavformat 59. 8.100 / 59. 8.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 16.101 / 8. 16.101
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100}}
Research
I have done the following:
- From https://www.martin-riedl.de/2020/04/17/using-ffmpeg-as-a-hls-streaming-server-overview/ which cover most of the scenarios working directly with ffmpeg command line.
- Checked the PyAV documentation
- Searched on Google
- Searched on Stack Overflow
- Looked through old GitHub issues
- Asked on PyAV Gitter
- ... and waited 72 hours for a response.
Additional context
Looking towards for any help possible.
Thanks,
Steve