Description
Recently i deployed jellyfin
on my openwrt router
using docker
. My jellyfin
version is 10.4.3
. After i mapped its media directory to the resources disk , i found when i opened the mkv format video
, it came out with following error : PlaybackErrorNoCompatibleStream
Then i tried some mp4 format video
, everything works on well. So i decided to transform it into mp4 format
. Here comes our hero – – – FFmpeg
Instruction
As you know mkv format video
can contain several audios and subtitles . So when we transform it to mp4
, we should choose which audio channel we would like to maintain , so as the subtitle.
First get video information
Use this command to find out information about the video
# replace your info
ffmpeg -i 1.mkv -hide_banner
Second do the transform
Accroding to its result , remember the audio you would like to choose. Such as #0:4(jpn)
, that means audio in Japanese version
is the fifth
stream.
Then we can use ffmpeg -map parameter to specify our choice.
# replace your info
ffmpeg -i 1.mkv -map 0:0 -map 0:a:3 -c:v copy 1.mp4
# or in this way
ffmpeg -i 1.mkv -map 0:0 -map 0:4 -c:v copy -c:a copy 2.mp4
0:a:3
means the fourth
audio. Though the Japanese version
is #0:4
, there is a video channel #0:0
before it. So you can simply use-map 0:4
or -map 0:a:3
Complement
- If you want directly to get the specific language audio
ffmpeg -i 1.mkv -map 0:m:language:jpn 1.aac/1.mp3
- if you want to include the subtitle
#0:6(eng):Subtitle:ass
(the first subtitle)
# replace your info | (:n) can be omitted when there is only one video stream, it's used to choose video channel
ffmpeg -i 1.mkv -map 0:v:0 -map 0:a:3 -vf subtitles=1.mkv 3.mp4
# other subtitle such as #0:12(chi):subtitle:ass (the sixth subtitle)
ffmpeg -i 1.mkv -map 0:v -map 0:a:3 -vf subtitles=1.mkv:si=5 3.mp4
Tip:
When you use vf subtitle
parameter , do not use -c copy
, or it will come out with
Filtergraph 'subtitles=1.mkv:si=2' was defined for video output stream 0:0 but codec copy was selected.
Filtering and streamcopy cannot be used together.
发表回复