Posts

Showing posts from June, 2025
 Convert normal video file to hls streaming ready files: for only one quality: ffmpeg -i my_video.mp4 -c:a copy -c:v copy -hls_time 6 -hls_list_size 0 -hls_segment_filename "segment%03d.ts" playlist.m3u8 for multiple quality like 360p, 720p, 1080p: ffmpeg -i input_video.mp4 -filter_complex "[0:v]split=3[v1][v2][v3];[v1]scale=w=1920:h=1080[v1out];[v2]scale=w=1280:h=720[v2out];[v3]scale=w=854:h=480[v3out]" -map "[v1out]" -c:v:0 libx264 -b:v:0 5000k -maxrate:v:0 5350k -bufsize:v:0 7500k -map "[v2out]" -c:v:1 libx264 -b:v:1 2800k -maxrate:v:1 2996k -bufsize:v:1 4200k -map "[v3out]" -c:v:2 libx264 -b:v:2 1400k -maxrate:v:2 1498k -bufsize:v:2 2100k -map a:0 -c:a:0 aac -b:a:0 192k -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 96k -ac 2 -f hls -hls_time 10 -hls_playlist_type vod -hls_flags independent_segments -hls_segment_type mpegts -hls_segment_filename stream_%v/data%03d.ts -master_pl_name master.m3u8 -var_stream_ma...
 Removing particular bug commit from git: >> git log --oneline >> git reset --hard <commitid> >> git push -f Removing particular file like big file more than 100 mb(not uploadable on github) removing from the previous commit: to remove the large file git rm --cached <filename> Then, to edit the commit git commit --amend -C HEAD # very important Then you can push your amended commit with git push
Image
 class ChatConsumer(AsyncWebsocketConsumer): async def connect(self): query_string_bytes = self.scope.get('query_string', b'') # 1. Get the raw query string from the scope query_string_str = query_string_bytes.decode('utf-8') # 2. Decode it from bytes to string (UTF-8 is a common encoding) query_params = parse_qs(query_string_str) # 3. Parse the query string into a dictionary token_list = query_params.get('token', []) # 4. Extract the token value token = token_list[0] if token_list else None user = await get_user_from_token(token) self.room_name = self.scope[ 'url_route' ][ 'kwargs' ][ 'room_name' ] self.room_group_name = f'chat_ {self.room_name} ' # Authenticate user if isinstance (user, AnonymousUser): await self.close() else : self.user = user # Join room group await self.channel_layer.group_add( self.room_group_name, self.channel_name ...