quasarstream / python-ffmpeg-video-streaming

📼 Package media content for online streaming(DASH and HLS) using FFmpeg
https://www.quasarstream.com/op/python/ffmpeg-streaming?u=py-ff
MIT License
834 stars 142 forks source link

1 frames left in the queue on closing, 1 frames left in the queue on closing\\nConversion failed!\\n"') #130

Open Ecosmos opened 5 months ago

Ecosmos commented 5 months ago

Discussed in https://github.com/quasarstream/python-ffmpeg-video-streaming/discussions/129

Originally posted by **Ecosmos** May 1, 2024 Hello everyone, I am converting .mp4 to hls and m3u8 and it works fine. However, for some videos, I am getting the following error. here is my code: video = ffmpeg_streaming.input(s3_bucket_url) logger.info(f"starting hls conversion") hls = video.hls(Formats.h264()) logger.info(f"starting hls representations") hls.auto_generate_representations() logger.info(f"done with hls representations") timestamp_str = DT.now().strftime("%Y%m%d%H%M%S") hls_name = f"{video.id}_{timestamp_str}__hls.m3u8" hls_object_key_local = ( f"{settings.MEDIA_ROOT}/videos/{video.id}/{hls_name}" ) logger.info(f"starting with hls output") hls.output(hls_object_key_local) logger.info(f"done with hls output") The code crashes at hls.output(hls_object_key_local) for some videos but not all The error message: vendor_id : [0][0][0][0]\n encoder : Lavc59.37.100 aac\nOutput #2, hls, to '/usr/src/app/media/videos/258/258_20240501095038__hls_720p.m3u8':\n Metadata:\n major_brand : mp42\n minor_version : 0\n compatible_brands: isomiso2mp41\n encoder : Lavf59.27.100\n Stream #2:0(eng): Video: h264, yuv420p(tv, bt709, progressive), 1280x720, q=2-31, 2048 kb/s, 29.92 fps, 90k tbn (default)\n Metadata:\n creation_time : 2024-05-01T09:50:30.000000Z\n handler_name : VideoHandle\n vendor_id : [0][0][0][0]\n encoder : Lavc59.37.100 libx264\n Side data:\n cpb: bitrate max/min/avg: 0/0/2048000 buffer size: 0 vbv_delay: N/A\n Stream #2:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp, 320 kb/s (default)\n Metadata:\n creation_time : 2024-05-01T09:50:31.000000Z\n handler_name : SoundHandle\n vendor_id : [0][0][0][0]\n encoder : Lavc59.37.100 aac\nframe= 29 fps=0.0 q=0.0 q=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A dup=3 drop=0 speed= 0x \r[aac @ 0x560ab5c5b880] Input contains (near) NaN/+-Inf\nError submitting audio frame to the encoder\n[libx264 @ 0x560ab57d57c0] final ratefactor: 35.15\n[aac @ 0x560ab5c5b880] Qavg: nan\n[aac @ 0x560ab5c5b880] 2 frames left in the queue on closing\n[libx264 @ 0x560ab5a02900] final ratefactor: 28.95\n[aac @ 0x560ab5d8c480] Qavg: nan\n[aac @ 0x560ab5d8c480] 1 frames left in the queue on closing\n[libx264 @ 0x560ab51ec7c0] final ratefactor: 23.71\n[aac @ 0x560ab5c92480] Qavg: nan\n[aac @ 0x560ab5c92480] 1 frames left in the queue on closing\nConversion failed!\n"
Ecosmos commented 5 months ago

I also tried with video = ffmpeg_streaming.input(s3_bucket_url,max_muxing_queue_size=999,muxing_queue_data_threshold=99999)

still same results