hr3lxphr6j / bililive-go

一个直播录制工具
GNU General Public License v3.0
3.83k stars 493 forks source link

抖音录制断录,经常复现 #592

Closed iamobj closed 3 months ago

iamobj commented 11 months ago

程序版本

0.7.19

所使用的 config 文件的内容

rpc:
  enable: true
  bind: 127.0.0.1:8080
debug: true
interval: 43
out_put_path: ./
ffmpeg_path: ''
log:
  out_put_folder: ./
  save_last_log: true
  save_every_log: false
feature:
  use_native_flv_parser: false
  remove_symbol_other_character: false
live_rooms:
  - url: https://live.douyin.com/keyis153
    is_listening: true
    quality: 0
out_put_tmpl: ''
video_split_strategies:
  on_room_name_changed: false
  max_duration: 0s
  max_file_size: 0
cookies: {}
on_record_finished:
  convert_to_mp4: false
  delete_flv_after_convert: false
  custom_commandline: ''
timeout_in_us: 60000000

程序 log

time="2023-11-05 23:18:45" level=debug msg="Http Request" Method=GET Path=/api/lives/d0685a4b082c1ececd1c79d101d96824 RemoteAddr="127.0.0.1:58845"
2
[http @ 0x60000027c0e0] Stream ends prematurely at 359110607, should be 18446744073709551615
[flv @ 0x132605d00] Packet corrupt (stream = 1, dts = 510065).
[NULL @ 0x133804fa0] Invalid NAL unit size (83582 > 28713).
[NULL @ 0x133804fa0] missing picture in access unit with size 29731
http://pull-f3.douyincdn.com/third/stream-114031181188563627_uhd.flv?auth_key=1699800080-0-0-79707cdc1bce77fbdb9ee03480a339e2: corrupt input packet in stream 1
[http @ 0x60000027c0e0] Stream ends prematurely at 359110607, should be 18446744073709551615
Error demuxing input file 0: Input/output error
http://pull-f3.douyincdn.com/third/stream-114031181188563627_uhd.flv?auth_key=1699800080-0-0-79707cdc1bce77fbdb9ee03480a339e2: Input/output error
frame=13621 fps= 24 q=-1.0 Lsize=  350694kB time=00:07:34.00 bitrate=6327.9kbits/s speed=0.79x    
video:332776kB audio:17297kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.177342%
time="2023-11-05 23:20:57" level=info msg="<nil>" host="陈伯(全能王)" room="中国区冠军世界赛亚军的直播间"
time="2023-11-06 01:05:03" level=debug msg="Http Request" Method=GET Path=/api/lives/d0685a4b082c1ececd1c79d101d96824 RemoteAddr="127.0.0.1:53883"
[flv @ 0x127804680] Packet corrupt (stream = 1, dts = 6341999).
[NULL @ 0x105a04e00] Invalid NAL unit size (149671 > 63232).
[NULL @ 0x105a04e00] missing picture in access unit with size 64209
http://pull-flv-f26.douyincdn.com/third/stream-114031181188563627_or4.flv?expire=6550ecdb&sign=b59505196f97eda563f58a3f1c4208ef: corrupt input packet in stream 1
time="2023-11-06 01:36:17" level=debug msg="Http Request" Method=GET Path=/api/lives RemoteAddr="127.0.0.1:55065"
time="2023-11-06 01:36:36" level=debug msg="Http Request" Method=GET Path=/api/lives/d0685a4b082c1ececd1c79d101d96824 RemoteAddr="127.0.0.1:55300"
Error demuxing input file 0: Operation timed out
http://pull-flv-f26.douyincdn.com/third/stream-114031181188563627_or4.flv?expire=6550ecdb&sign=b59505196f97eda563f58a3f1c4208ef: Operation timed out
frame=171301 fps= 21 q=-1.0 Lsize= 4512827kB time=01:35:09.95 bitrate=6474.5kbits/s speed=0.699x    
video:4287276kB audio:217760kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.172929%
time="2023-11-06 01:37:11" level=info msg="<nil>" host="陈伯(全能王)" room="中国区冠军世界赛亚军的直播间"
time="2023-11-06 02:04:10" level=debug msg="Http Request" Method=GET Path=/api/lives/d0685a4b082c1ececd1c79d101d96824 RemoteAddr="127.0.0.1:57484"
[flv @ 0x157605d00] Packet corrupt (stream = 0, dts = 8853965).
[NULL @ 0x157705a40] Invalid NAL unit size (23431 > 5569).
[NULL @ 0x157705a40] missing picture in access unit with size 5584
http://pull-flv-f1.douyincdn.com/third/stream-114031181188563627_or4.flv?keeptime=00093a80&wsSecret=29bb40d494f68fadff13c1f0df3a59f6&wsTime=6547cb3a: corrupt input packet in stream 0
time="2023-11-06 02:04:29" level=error msg="failed to load room info" error="Get \"https://live.douyin.com/keyis153\": read tcp 192.168.50.31:53824->221.230.245.105:443: read: operation timed out" url="https://live.douyin.com/keyis153"
2
time="2023-11-06 02:05:04" level=debug msg="Http Request" Method=GET Path=/api/lives/d0685a4b082c1ececd1c79d101d96824 RemoteAddr="127.0.0.1:58120"
Error demuxing input file 0: Operation timed out
http://pull-flv-f1.douyincdn.com/third/stream-114031181188563627_or4.flv?keeptime=00093a80&wsSecret=29bb40d494f68fadff13c1f0df3a59f6&wsTime=6547cb3a: Operation timed out
frame= 1320 fps=0.8 q=-1.0 Lsize=   34682kB time=00:00:43.91 bitrate=6469.6kbits/s speed=0.026x    
video:32914kB audio:1707kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.177086%
time="2023-11-06 02:05:17" level=info msg="<nil>" host="陈伯(全能王)" room="中国区冠军世界赛亚军的直播间"
time="2023-11-06 02:24:00" level=debug msg="Http Request" Method=GET Path=/api/lives/d0685a4b082c1ececd1c79d101d96824 RemoteAddr="127.0.0.1:59969"
4
[flv @ 0x139f04680] Packet corrupt (stream = 1, dts = 10539999).
[NULL @ 0x139e079c0] Invalid NAL unit size (332903 > 320562).
[NULL @ 0x139e079c0] missing picture in access unit with size 321539
http://pull-flv-f26.douyincdn.com/third/stream-114031181188563627_or4.flv?expire=655113ca&sign=40a729b50d773592a4eac443c425fc2f: corrupt input packet in stream 1

[q] command received. Exiting.

frame= 1441 fps=1.3 q=-1.0 Lsize=   37948kB time=00:00:47.94 bitrate=6484.0kbits/s speed=0.0419x    
video:36407kB audio:1474kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.176298%
Error demuxing input file 0: Operation timed out
time="2023-11-06 02:41:32" level=info msg="<nil>" host="陈伯(全能王)" room="中国区冠军世界赛亚军的直播间"

自由描述

表现

如日志所示,一报错录制就断了,然后等十分钟到三十分钟左右,会新开一个文件来保存录制,但是和上一个文件中间有段时间是没录上的

这个问题在 0.7.18 版本也存在,试过添加自己的 cookie 还是会出现

kira1928 commented 11 months ago

memo: 'corrupt input packet in stream 1' error in FFMPEG

iamobj commented 11 months ago

memo: 'corrupt input packet in stream 1' error in FFMPEG

所以是要加 -fflags +discardcorrupt 参数吗,另外我看了下另外一个同类的开源项目,看到是有这个参数,看他的参数还蛮多的,发出来,你看看有没有参考价值 https://github.com/ihmily/DouyinLiveRecorder/blob/61fea23bbf2b039593bf50c320032e3cc428a94a/main.py#L669C64-L669C64