FFmpeg:按语言选择音频流 [英] FFmpeg: Choosing audio streams by language
问题描述
我正在尝试对电视流进行转码,但仅包含英语音频流.我尝试使用 -map 0:m:language:eng
流说明符,但得到:
I am trying to transcode tv streams but with only the english audio stream included. I have tried using the -map 0:m:language:eng
stream specifier, but I get:
"Automatic encoder selection failed for output stream #0:3. Default encoder for format mpegts (codec none) is probably disabled. Please choose an encoder manually.
Error selecting an encoder for stream 0:3"
尽管包含了编码器,但仍然如此.我已经尝试过各种关于此主题的变体,但都没有成功.
This is despite including an encoder. I have tried all sorts of variations on this theme without success.
一次一次尝试的完整输出如下:
ffmpeg -i http://192.168.1.74:8001/1:0:1:189E:7FD:2:11A0000:0:0:0: -ignore_unknown -map 0:a -map 0:m:language:eng -map 0:v -acodec aac -vcodec libx264 -b:v 1100000 -t 00:00:30 "somethin.ts" 2>output.txt
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 03db7b60] Could not find codec parameters for stream 17 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 03db7b60] Could not find codec parameters for stream 18 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'http://192.168.1.74:8001/1:0:1:189E:7FD:2:11A0000:0:0:0:':
Duration: N/A, start: 23690.732933, bitrate: N/A
Program 6321
Program 6322
Program 6338
Program 6301
Program 6302
Stream #0:0[0x13ec]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x13ee](NAR): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 224 kb/s
Stream #0:2[0x13ed](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 224 kb/s
Stream #0:3[0x13ef](eng,eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Stream #0:4[0x13f0](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
Stream #0:5[0xf04]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:6[0xf03]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:7[0xf02]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:8[0xf01]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:9[0xf00]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:10[0x92a]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:11[0x913]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:12[0x912]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:13[0x911]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:14[0x919]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:15[0xf09]: Unknown: none ([11][0][0][0] / 0x000B)
Stream #0:16[0xf08]: Unknown: none ([11][0][0][0] / 0x000B)
Stream #0:17[0xf07]: Unknown: none ([11][0][0][0] / 0x000B)
Stream #0:18[0xf06]: Unknown: none ([11][0][0][0] / 0x000B)
Program 6318
Program 6390
Program 6391
Program 6351
Program 6361
Program 6306
Program 6341
Automatic encoder selection failed for output stream #0:3. Default encoder for format mpegts (codec none) is probably disabled. Please choose an encoder manually.
Error selecting an encoder for stream 0:3
有关如何执行此操作的任何想法.我无法按数字指定流,因为我想将其用于许多电视流,并且顺序通常是不同的.
Any ideas on how to do this. I cant specify streams by number as I want to use it for lots of tv streams and the order is often different.
谢谢
推荐答案
输出流 0:3
是基于图像的字幕流.由于您尚未为字幕指定编码器,因此ffmpeg尝试选择一种编码器,但由于它没有基于图像的字幕编码器而失败.您可以复制或删除流.
Output stream 0:3
is a image-based subtitle stream. Since you've not specified an encoder for subtitles, ffmpeg is trying to pick one and fails since it doesn't have an image-based subtitle encoder. You can copy or drop the stream.
ffmpeg -i http://192.168.1.74:8001/1:0:1:189E:7FD:2:11A0000:0:0:0: -ignore_unknown -c copy -map 0:a -map 0:m:language:eng -map 0:v -acodec aac -vcodec libx264 -b:v 1100000 -t 00:00:30 "somethin.ts" 2>output.txt
当然,您的主要目的是仅按语言映射音频流.您的命令会将视频映射两次,因为它被标记为英语.
Of course, your primary aim is to map only the audio stream by language. Your command will map the video twice, as it is tagged as English.
为避免这种情况,可以使用两个ffmpeg命令:
To avoid this, you can use two ffmpeg commands:
ffmpeg -i http://192.168.1.74:8001/1:0:1:189E:7FD:2:11A0000:0:0:0: -ignore_unknown -c copy -map 0:v:0 -map 0:m:language:eng -f mpegts - | ffmpeg -f mpegts -i - -map 0:v:0 -map 0:a:0 -c:a aac -c:v libx264 -b:v 1.1M out.ts
这篇关于FFmpeg:按语言选择音频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!