当前位置:   article > 正文

Black群晖VideoStation不支持音频 DTS\EAC3\TureHD的解决办法_video station ffmpeg

video station ffmpeg

前几天自己手贱,更新了VideoStation,更新完又回到不支持 DTS格式的情况,之前修复的方法又没做笔记,所以这次把笔记做好,防止下次!

1、安装或更新完VideoStation后,接着安装ffmpeg(我安装的是4.4.4.49),再安装Media Extensions;

2、停用VideoStation;

3、到控制面板里面打开ssh;

4、用电脑ssh远程连接到群晖上;

5、获取su权限sudo -i,输入后回车再输一次密码;

6、依次执行以下命令:如果第二条命令执行失败,请看完解决办法后再继续执行下面的几条命令。

#重名备份ffmpeg41为ffmpeg41.orig
mv /var/packages/CodecPack/target/pack/bin/ffmpeg41 /var/packages/CodecPack/target/pack/bin/ffmpeg41.orig
# 这里可能因为无法访问 github 失败,下面又解决办法,请看完再继续下面的命令
wget -O - https://raw.githubusercontent.com/Rootjhon/Synology_Enhance/main/VideoStation/DSM7_1/ffmpeg41-wrapper > /var/packages/CodecPack/target/pack/bin/ffmpeg41
#修改ffmpeg41 权限
chmod 755 /var/packages/CodecPack/target/pack/bin/ffmpeg41
#重名备份libsynovte.so 为libsynovte.so.orig
cp -n /var/packages/VideoStation/target/lib/libsynovte.so /var/packages/VideoStation/target/lib/libsynovte.so.orig
#修改libsynovte.so.orig的用户组权限
chown VideoStation:VideoStation /var/packages/VideoStation/target/lib/libsynovte.so.orig
#设置解码
sudo sed -i -e 's/eac3/3cae/' -e 's/dts/std/' -e 's/truehd/dheurt/' /var/packages/VideoStation/target/lib/libsynovte.so
#重启VideoStation
sudo synopkg restart VideoStation
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

好了,如果你顺利执行上面的命令,那恭喜你,应该解决了。如果第二条命令执行失败,往下看。

现在说说第二条命令,这条命令是把https://raw.githubusercontent.com/Rootjhon/Synology_Enhance/main/VideoStation/DSM7_1/ffmpeg41-wrapper脚本下载到/var/packages/CodecPack/target/pack/bin/并命名为ffmpeg41。由于git被墙了,除非有梯子,要不然没办法。哈哈~~不过我已经把上面的脚本下载下来了,继续往下看怎么解决。

1、在/var/packages/CodecPack/target/pack/bin/下创建ffmpeg41,执行下面命令:

vim /var/packages/CodecPack/target/pack/bin/ffmpeg41
  • 1

2、复制下面代码,粘贴上去:

#!/bin/bash

# Fork from code of BenjaminPoncet rev.12 with some revisions and little fixes.
rev="AME_12.3.1"

_log(){
	echo "$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} - $1" >> /tmp/ffmpeg.log
}

_log_para(){
	echo "$1" | fold -w 120 | sed "s/^.*$/$(date '+%Y-%m-%d %H:%M:%S') - ${streamid} -          = &/" >> /tmp/ffmpeg.log
}

_term(){
	rm /tmp/ffmpeg-${streamid}.stderr
	_log "*** KILLCHILD ***"
	kill -TERM "$childpid" 2>/dev/null
}

trap _term SIGTERM

arch=`uname -a | sed 's/.*synology_//' | cut -d '_' -f 1`
nas=`uname -a | sed 's/.*synology_//' | cut -d '_' -f 2`
pid=$$
paramvs=$@
stream="${@: -1}"
streamid="FFM$pid"
bin1=/var/packages/CodecPack/target/pack/bin/ffmpeg41.orig
bin2=/var/packages/ffmpeg/target/bin/ffmpeg
args=()

vcodec="KO"

while [[ $# -gt 0 ]]
do
case "$1" in
	-i)
		shift
		movie="$1"
		args+=("-i" "$1")
	;;
	-hwaccel)
		shift
		hwaccel="$1"
		args+=("-hwaccel" "$1")
	;;
	-scodec)
		shift
		scodec="$1"
		args+=("-scodec" "$1")
	;;
	-f)
		shift
		fcodec="$1"
		args+=("-f" "$1")
	;;
	-map)
		shift
		args+=("-map" "$1")
		idmap=`echo $1 | cut -d : -f 2`
		if [ "$vcodec" = "KO" ]; then
			vcodec=`/var/packages/ffmpeg/target/bin/ffprobe -v error -select_streams $idmap -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$movie" | head -n 1`
			vcodecprofile=`/var/packages/ffmpeg/target/bin/ffprobe -v error -select_streams $idmap -show_entries stream=profile -of default=noprint_wrappers=1:nokey=1 "$movie" | head -n 1`
		else
			acodec=`/var/packages/ffmpeg/target/bin/ffprobe -v error -select_streams $idmap -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "$movie" | head -n 1`
		fi
	;;
	*)
		args+=("$1")
	;;
esac
shift
done

_log "*** PROCESS START REV $rev DS$nas ($arch) PID $pid ***"

_log "MOVIE    = $movie"

set -- "${args[@]}"

argsnew=()
args1sv=()
args2sv=()
args1vs=()
args2vs=()

while [[ $# -gt 0 ]]
do
case "$1" in
	-ss)
		shift
		argsnew+=("-ss" "$1")
		args1sv+=("-ss" "$1")
		args1sv+=("-noaccurate_seek")
		args1vs+=("-ss" "$1")
		args1vs+=("-noaccurate_seek")
		args2sv+=("-analyzeduration" "10000000")
		args2vs+=("-analyzeduration" "10000000")
	;;
	-i)
		shift
		argsnew+=("-i" "$1")
		args1sv+=("-i" "$1")
		args2sv+=("-i" "pipe:0" "-map" "0")
		args1vs+=("-i" "$1")
		args2vs+=("-i" "pipe:0" "-map" "0")
	;;
	-vf)
		shift
		if [ "$hwaccel" = "vaapi" ] && [ "$vcodecprofile" = "Main 10" ]; then
			scale_w=`echo "${1}" | sed -e 's/.*=w=//g' | sed -e 's/:h=.*//g'`
			scale_h=`echo "${1}" | sed -e 's/.*:h=//g'`
			if let ${scale_w} AND let ${scale_h}; then
				argsnew+=("-vf" "scale_vaapi=w=${scale_w}:h=${scale_h}:format=nv12,hwupload,setsar=sar=1")
			else
				argsnew+=("-vf" "scale_vaapi=format=nv12,hwupload,setsar=sar=1")
			fi
		else
			argsnew+=("-vf" "$1")
		fi
		args2sv+=("-vf" "$1")
		args1vs+=("-vf" "$1")
	;;
	# Para activar los límites de Bitrate que trae el VideoStation. Si se quieren fijar siempre a un valor, cambiar el $1 y poner 8M por ejemplo.
	-vb)
    		shift
		argsnew+=("-vb" "$1")
		args1sv+=("-vb" "$1")
		args2sv+=("-vb" "$1")
		args1vs+=("-vb" "$1")
		args2vs+=("-vb" "$1")
	;;
	-vcodec)
		shift
		argsnew+=("-vcodec" "$1")
		args1sv+=("-vcodec" "copy")
		args2sv+=("-vcodec" "$1")
		args1vs+=("-vcodec" "$1")
		args2vs+=("-vcodec" "copy")
	;;
	-acodec)
		shift
		if [ "$1" = "libfaac" ]; then
			argsnew+=("-acodec" "aac")
			args1sv+=("-acodec" "aac")
			args2vs+=("-acodec" "aac")
		else
			argsnew+=("-acodec" "$1")
			args1sv+=("-acodec" "$1")
			args2vs+=("-acodec" "$1")
		fi
		args2sv+=("-acodec" "copy")
		args1vs+=("-acodec" "copy")
	;;
	-ab)
		shift
		argsnew+=("-ab" "$1")
		args1sv+=("-ab" "$1")
		args2vs+=("-ab" "$1")
	;;
	-ac)
		shift
		argsnew+=("-ac" "$1")
		args1sv+=("-ac" "$1")
		args2vs+=("-ac" "$1")
	;;
	-f)
		shift
		argsnew+=("-f" "$1")
		args1sv+=("-f" "mpegts")
		args2sv+=("-f" "$1")
		args1vs+=("-f" "mpegts")
		args2vs+=("-f" "$1")
	;;
	-segment_format)
		shift
		argsnew+=("-segment_format" "$1")
		args2vs+=("-segment_format" "$1")
		args2sv+=("-segment_format" "$1")
	;;
	-segment_list_type)
		shift
		argsnew+=("-segment_list_type" "$1")
		args2vs+=("-segment_list_type" "$1")
		args2sv+=("-segment_list_type" "$1")
	;;
	-hls_seek_time)
		shift
		argsnew+=("-hls_seek_time" "$1")
		args2vs+=("-hls_seek_time" "$1")
		args2sv+=("-hls_seek_time" "$1")
	;;
	-segment_time)
		shift
		argsnew+=("-segment_time" "$1")
		args2vs+=("-segment_time" "$1")
		args2sv+=("-segment_time" "$1")
	;;
	-segment_time_delta)
		shift
		argsnew+=("-segment_time_delta" "$1")
		args2vs+=("-segment_time_delta" "$1")
		args2sv+=("-segment_time_delta" "$1")
	;;
	-segment_start_number)
		shift
		argsnew+=("-segment_start_number" "$1")
		args2vs+=("-segment_start_number" "$1")
		args2sv+=("-segment_start_number" "$1")
	;;
	-individual_header_trailer)
		shift
		argsnew+=("-individual_header_trailer" "$1")
		args2vs+=("-individual_header_trailer" "$1")
		args2sv+=("-individual_header_trailer" "$1")
	;;
	-avoid_negative_ts)
		shift
		argsnew+=("-avoid_negative_ts" "$1")
		args2vs+=("-avoid_negative_ts" "$1")
		args2sv+=("-avoid_negative_ts" "$1")
	;;
	-break_non_keyframes)
		shift
		argsnew+=("-break_non_keyframes" "$1")
		args2vs+=("-break_non_keyframes" "$1")
		args2sv+=("-break_non_keyframes" "$1")
	;;
	-max_muxing_queue_size)
		shift
		args2vs+=("-max_muxing_queue_size" "$1")
		args2sv+=("-max_muxing_queue_size" "$1")
	;;
	-map)
		shift
		argsnew+=("-map" "$1")
		args1sv+=("-map" "$1")
		args1vs+=("-map" "$1")
	;;
	*)
		argsnew+=("$1")
		if [ "$stream" = "$1" ]; then
			args1sv+=("-bufsize" "8192k" "pipe:1")
			args2sv+=("$1")
			args1vs+=("-bufsize" "8192k" "pipe:1")
			args2vs+=("$1")
		else
			args2sv+=("$1")
			args1vs+=("$1")
			args2vs+=("$1")
		fi
	;;
esac
shift
done

sed -i -e "s/{\"PID\":${pid},\"hardware_transcode\":true,/{\"PID\":${pid},\"hardware_transcode\":false,/" /tmp/VideoStation/enabled

startexectime=`date +%s`

if [ "$scodec" = "subrip" ]; then	

	_log "FFMPEG   = $bin1"
	_log "CODEC    = $scodec"
	_log "PARAMVS  ="
	_log_para "$paramvs"
	
	$bin1 "${args[@]}" 2> /tmp/ffmpeg-${streamid}.stderr &

elif [ "$fcodec" = "mjpeg" ]; then	

	_log "FFMPEG   = $bin1"
	_log "CODEC    = $fcodec"
	_log "PARAMVS  ="
	_log_para "$paramvs"
	
	$bin1 "${args[@]}" 2> /tmp/ffmpeg-${streamid}.stderr &

else

	_log "VCODEC   = $vcodec ($vcodecprofile)"
	_log "ACODEC   = $acodec"
	_log "PARAMVS  ="
	_log_para "$paramvs"
	_log "MODE     = ORIG"
	_log "FFMPEG   = $bin1"
	_log "PARAMWP  ="
	param1=${argsnew[@]}
	_log_para "$param1"

	$bin1 "${argsnew[@]}" 2> /tmp/ffmpeg-${streamid}.stderr &

fi

childpid=$!
_log "CHILDPID = $childpid"
wait $childpid

if grep "Conversion failed!" /tmp/ffmpeg-${streamid}.stderr || grep "not found for input stream" /tmp/ffmpeg-${streamid}.stderr || grep "Error opening filters!" /tmp/ffmpeg-${streamid}.stderr || grep "Unrecognized option" /tmp/ffmpeg-${streamid}.stderr || grep "Invalid data found when processing input" /tmp/ffmpeg-${streamid}.stderr; then

	_log "*** CHILD END ***"
	startexectime=`date +%s`
	_log "STDOUT   ="
	_log_para "`tail -n 15 /tmp/ffmpeg-${streamid}.stderr`"
	# _log_para "`cat /tmp/ffmpeg-${streamid}.stderr`"
	_log "MODE     = PIPE V_ORIG-A_WRAP"
	_log "FFMPEG1  = $bin1"
	_log "FFMPEG2  = $bin2"
	_log "PARAM1   ="
	param1=${args1vs[@]}
	_log_para "$param1"
	_log "PARAM2   ="
	param2=${args2vs[@]}
	_log_para "$param2"

	$bin1 "${args1vs[@]}" | $bin2 "${args2vs[@]}" 2> /tmp/ffmpeg-${streamid}.stderr &

	childpid=$!
	_log "CHILDPID = $childpid"
	wait $childpid

fi

if grep "Conversion failed!" /tmp/ffmpeg-${streamid}.stderr || grep "not found for input stream" /tmp/ffmpeg-${streamid}.stderr || grep "Error opening filters!" /tmp/ffmpeg-${streamid}.stderr || grep "Unrecognized option" /tmp/ffmpeg-${streamid}.stderr || grep "Invalid data found when processing input" /tmp/ffmpeg-${streamid}.stderr; then

	_log "*** CHILD END ***"
	startexectime=`date +%s`
	_log "STDOUT   ="
	_log_para "`tail -n 15 /tmp/ffmpeg-${streamid}.stderr`"
	# _log_para "`cat /tmp/ffmpeg-${streamid}.stderr`"
	_log "MODE     = PIPE V_WRAP-A_ORIG"
	_log "FFMPEG1  = $bin2"
	_log "FFMPEG2  = $bin1"
	_log "PARAM1   ="
	param1=${args1sv[@]}
	_log_para "$param1"
	_log "PARAM2   ="
	param2=${args2sv[@]}
	_log_para "$param2"

	$bin2 "${args1sv[@]}" | $bin1 "${args2sv[@]}" 2> /tmp/ffmpeg-${streamid}.stderr &

	childpid=$!
	_log "CHILDPID = $childpid"
	wait $childpid

fi

if grep "Conversion failed!" /tmp/ffmpeg-${streamid}.stderr || grep "not found for input stream" /tmp/ffmpeg-${streamid}.stderr || grep "Error opening filters!" /tmp/ffmpeg-${streamid}.stderr || grep "Unrecognized option" /tmp/ffmpeg-${streamid}.stderr || grep "Invalid data found when processing input" /tmp/ffmpeg-${streamid}.stderr; then

	_log "*** CHILD END ***"
	startexectime=`date +%s`
	_log "STDOUT   ="
	_log_para "`tail -n 15 /tmp/ffmpeg-${streamid}.stderr`"
	# _log_para "`cat /tmp/ffmpeg-${streamid}.stderr`"
	_log "MODE     = WRAPPER"
	_log "FFMPEG   = $bin2"

	$bin2 "${args[@]}" 2> /tmp/ffmpeg-${streamid}.stderr &

	childpid=$!
	_log "CHILDPID = $childpid"
	wait $childpid

fi

stopexectime=`date +%s`
if test $((stopexectime-startexectime)) -lt 10; then
	_log "STDOUT   ="
	_log_para "`tail -n 22 /tmp/ffmpeg-${streamid}.stderr`"
	# _log_para "`cat /tmp/ffmpeg-${streamid}.stderr`"
fi

_log "*** CHILD END ***"
_log "*** PROCESS END ***"

rm /tmp/ffmpeg-*.stderr
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315
  • 316
  • 317
  • 318
  • 319
  • 320
  • 321
  • 322
  • 323
  • 324
  • 325
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • 333
  • 334
  • 335
  • 336
  • 337
  • 338
  • 339
  • 340
  • 341
  • 342
  • 343
  • 344
  • 345
  • 346
  • 347
  • 348
  • 349
  • 350
  • 351
  • 352
  • 353
  • 354
  • 355
  • 356
  • 357
  • 358
  • 359
  • 360
  • 361
  • 362
  • 363
  • 364
  • 365
  • 366
  • 367
  • 368
  • 369
  • 370
  • 371
  • 372
  • 373
  • 374
  • 375
  • 376
  • 377

3、按esc键退出编辑模式,输入:wq保存退出,然后继续上面的命令完成即可。

收工!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/1011408
推荐阅读
相关标签
  

闽ICP备14008679号