修复ROI截图:改用ZLM内部RTSP地址,解决ffmpeg无法直连摄像头源的问题

后端改用app/stream参数构建ZLM内部地址(rtsp://127.0.0.1:{port}/{app}/{stream}),
避免ffmpeg从Docker内直接连接摄像头RTSP源。增加47255字节默认logo检测。
前端同步更新snap URL构建方式。

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-04 09:59:00 +08:00
parent 682b56a2ec
commit 88da798cc0
3 changed files with 32 additions and 18 deletions

View File

@@ -25,6 +25,7 @@ export function stopCamera(id) {
})
}
export function getSnapUrl(srcUrl) {
return `/api/ai/roi/snap?url=${encodeURIComponent(srcUrl)}`
export function getSnapUrl(app, stream) {
const base = process.env.NODE_ENV === 'development' ? process.env.VUE_APP_BASE_API : ''
return `${base}/api/ai/roi/snap?app=${encodeURIComponent(app)}&stream=${encodeURIComponent(stream)}`
}

View File

@@ -97,6 +97,8 @@ export default {
return {
cameraId: '',
srcUrl: '',
app: '',
stream: '',
drawMode: null,
roiList: [],
selectedRoiId: null,
@@ -113,10 +115,9 @@ export default {
mounted() {
this.cameraId = decodeURIComponent(this.$route.params.cameraId)
this.srcUrl = this.$route.query.srcUrl || ''
if (this.srcUrl) {
const base = process.env.NODE_ENV === 'development' ? process.env.VUE_APP_BASE_API : ''
this.snapUrl = `${base}/api/ai/roi/snap?url=${encodeURIComponent(this.srcUrl)}`
}
this.app = this.$route.query.app || ''
this.stream = this.$route.query.stream || ''
this.buildSnapUrl()
this.loadRois()
},
methods: {
@@ -145,12 +146,15 @@ export default {
startDraw(mode) {
this.drawMode = mode
},
refreshSnap() {
if (this.srcUrl) {
buildSnapUrl() {
if (this.app && this.stream) {
const base = process.env.NODE_ENV === 'development' ? process.env.VUE_APP_BASE_API : ''
this.snapUrl = `${base}/api/ai/roi/snap?url=${encodeURIComponent(this.srcUrl)}&t=${Date.now()}`
this.snapUrl = `${base}/api/ai/roi/snap?app=${encodeURIComponent(this.app)}&stream=${encodeURIComponent(this.stream)}&t=${Date.now()}`
}
},
refreshSnap() {
this.buildSnapUrl()
},
onRoiDrawn(data) {
this.drawMode = null
const newRoi = {