kurt_steiner
01/19/2024, 5:51 AMmpv
player can just play it for 4 seconds, I can't control the progress bar, but the <video> tag in web browser works well, I don't know what the matter with my code, can you help me out ?kurt_steiner
01/19/2024, 5:53 AMsteiner@archlinux ~/w/j/ArgumentParser.jl (master) [128]> mpv "<http://localhost:8083/api/video/1>"
(+) Video --vid=1 (*) (h264 1920x1080 23.976fps)
(+) Audio --aid=1 --alang=jpn (*) (aac 2ch 48000Hz)
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: Packet corrupt (stream = 0, dts = 152152).
[ffmpeg] NULL: Invalid NAL unit size (27651 > 15373).
[ffmpeg] NULL: missing picture in access unit with size 15377
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: stream 0, offset 0x1b57cc: partial file
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 1920x1080 yuv420p
AV: 00:00:01 / 00:23:55 (0%) A-V: 0.000 Cache: 4.7s/1MB
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: stream 0, offset 0x1b7138: partial file
AV: 00:07:53 / 00:23:55 (33%) A-V: 0.000 Cache: 0.0s/57KB
[ffmpeg/video] h264: Invalid NAL unit size (27651 > 15373).
[ffmpeg/video] h264: Error splitting the input into NAL units.
Error while decoding frame!
AV: 00:07:53 / 00:23:55 (33%) A-V: 0.000 Cache: 0.0s/1KB
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: stream 1, offset 0x1b8a45: partial file
AV: 00:00:00 / 00:23:55 (0%) A-V: 0.000 Cache: 5.2s/1MB
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: stream 1, offset 0x1b8c9d: partial file
AV: 00:07:53 / 00:23:55 (33%) A-V: 0.000 Cache: 0.0s/137KB
[ffmpeg/video] h264: Invalid NAL unit size (27651 > 15373).
[ffmpeg/video] h264: Error splitting the input into NAL units.
Error while decoding frame!
AV: 00:07:53 / 00:23:55 (33%) A-V: 0.000 Cache: 0.0s/1KB
Exiting... (End of file)
Daniel Pitts
01/19/2024, 3:47 PMKlitos Kyriacou
01/19/2024, 4:10 PMvar range = 0L
if (!rangeString.isBlank()) {
range = java.lang.Long.valueOf(rangeString.substring(rangeString.indexOf("=") + 1, rangeString.indexOf("-")))
}
I would change it to:
val range =
if (!rangeString.isBlank()) 0L
else (rangeString.substringAfter("=").substringBefore("-")).toLong()
Shawn
01/19/2024, 11:46 PMval range = rangeString.takeIf { it.isNotBlank() }
?.substringAfter("=")
?.substringBefore("-")
?.toLong()
?: 0L
(there might also be a better way of getting the substring in question, but that's a different problem)