Opened 7 months ago

#6167 new enhancement

ffmpeg subtitles to overlay by language

Reported by: milanc Owned by:
Priority: normal Component: avfilter
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

How to reproduce:
ffmpeg version N-83522-g6a37abc

my stream looks like this:
Input #0, mpegts, from 'udp://@...':
  Duration: N/A, start: 19316.897278, bitrate: N/A
  Program 504
    Stream #0:0[0x13b1], 125, 1/90000: Video: mpeg2video (Main), 1 reference frame ([2][0][0][0] / 0x0002), yuv420p(tv, top first, left), 720x576 [SAR 64:45 DAR 16:9], 0/1, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x13b2], 208, 1/90000: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 256 kb/s
    Stream #0:2[0x1541](srp), 4, 1/90000: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:3[0x1542](slv), 3, 1/90000: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:4[0x1543](hrv), 4, 1/90000: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:5[0x1544](cze), 3, 1/90000: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:6[0x1545](hun), 4, 1/90000: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:7[0x1546](ron), 3, 1/90000: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:8[0x1547](alb), 4, 1/90000: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:9[0x1548](bul), 5, 1/90000: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
    Stream #0:10[0x13b9](eng), 127, 1/90000: Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)

I try to add english subtitles into output video, but number of subtitles/languages is variable in time. I need select required subtitles by language. How can I do? Here is my not working example. Thank you.

I tried eg.

ffmpeg -i "udp://@..." -map s:eng -sn -map v:0 -profile:v baseline
-c:v libx264 -b:v 1500k -maxrate 2200k -filter_complex [0:v][0:s]overlay -c:a libfdk_aac -b:a 128k /test.ts

-filter_complex [0:v][s:10]overlay ...

ffmpeg -i "udp://@..." -map m:language:eng -map "sub" -map v:0 -profile:v baseline -c:v libx264 -b:v 1500k -maxrate 2200k -bufsize 4400k -deinterlace -filter_complex "[0:v]crop=in_w-0:in_h-0[cropped];[cropped]scale=720:576[scaled];[scaled]unsharp=3:3:0.5:3:3:0.5[unsharped];[unsharped][sub]overlay" -keyint_min 15 -g 150 -map a:0 -c:a libfdk_aac -b:a 128k -ar 44100 -ac 2 -sn /a.ts

But every time I have in the video srp [0] subtitles.

Change History (0)

Note: See TracTickets for help on using tickets.