一行命令解决电视盒子播放电视剧无声音的问题
程序员文章站
2022-03-15 11:02:53
...
快过年了,防止无聊,下载了部经典喜剧在电视盒子上看看。
现在片源越来越不好找了,好不容易下了部
回家在机顶盒上一播放,傻眼了,有图像没声音,声道切换也不管用
这点事情难不倒程序猿,ffprobe查看视频属性
ffprobe 01.mkv
结果
ffprobe version 4.1.3 Copyright (c) 2007-2019 the FFmpeg developers
built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, matroska,webm, from '01.mkv':
Metadata:
encoder : libebml v1.3.0 + libmatroska v1.4.0
creation_time : 2014-08-06T02:14:45.000000Z
Duration: 00:42:07.96, start: 0.000000, bitrate: 2324 kb/s
Stream #0:0: Video: h264 (High), yuv420p(progressive), 720x540 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 1k tbn, 50 tbc (default) (forced)
Metadata:
title : aaa@qq.com小五压制
Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default) (forced)
Metadata:
title : 国语
Stream #0:2: Subtitle: ass (default) (forced)
Metadata:
title : 简体中字
Stream #0:3: Subtitle: ass
Metadata:
title : 繁体中字
多出了几个Stream,删除掉这些,应该就能顺利播放,新建out目录
mkdir out
解释那么多核心命令就是这一行:
find . | grep mkv| sed 's#./##g' |xargs -n 1 -I {} ffmpeg -i {} -map 0:0 -map 0:1 -vcodec copy -acodec copy out/{}
所有处理后的视频都放到当前文件夹out子目录里
再次用ffprob查看处理后的结果
ffprobe 01.mkv
ffprobe version 4.1.3 Copyright (c) 2007-2019 the FFmpeg developers
built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, matroska,webm, from '01.mkv':
Metadata:
ENCODER : Lavf58.20.100
Duration: 00:42:07.96, start: 0.000000, bitrate: 2325 kb/s
Stream #0:0: Video: h264 (High), yuv420p(progressive), 720x540 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 1k tbn, 50 tbc (default) (forced)
Metadata:
title : aaa@qq.com小五压制
DURATION : 00:42:07.960000000
Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default) (forced)
Metadata:
title : 国语
DURATION : 00:42:07.904000000
轨道正常一个Video,一个Audio,机顶盒顺利播放!
全文结束