问题
I try to hardcode the dvb subtitle in the video. I managed to hardcode it but it is still misplaced. The reason for this is that the subtitle is on SD resolution 720x576 while the video is 1920x1080.
So when I use overlay the subtitle is is misplaced and on the left corner.
this is my command:
ffmpeg -canvas_size 1280x720 -y -probesize 5000000 -analyzeduration 5000000 -i http://192.168.2.9:8001 -filter_complex "[0:s]scale=1280:720[sub],[0:v]scale=1280:720,yadif=1[vid];[vid][sub]overlay[all]" -map "[all]" -map a:0 -strict -2 -dn -vcodec h264 -acodec aac -preset superfast -scodec copy -b:v 2000k -b:a 96k -maxrate 3000k -crf 26 -r 25 -ac 2 -threads 0 -hls_flags delete_segments -hls_time 10 -hls_list_size 6 testbst.ts
The subtitle needs to be upscaled and/or placed in the center bottom of the screen. Any help is appreciated.
回答1:
Ihad this prolem with subtitles, managed to fix with:
-filter_complex "[0:s:0] scale=-1:2400 [sub],[0:v][sub] overlay=x=150:y=-80"
where:
scale - size of subtitle
overlay x= - vertical
overlay y= - horizontal
回答2:
preview.ibb.co/ibNB4k/1.jpg First code
At the first one, subtitles are little bit high, and the code is:
ffmpeg -i http://localhost:9099/play/a07w -metadata title="Cinemax" -filter_complex "[0:s:0] scale=-1:500 [sub],[0:v][sub] overlay=x=30:y=-10" -c:v libx264 -crf 20 -preset veryfast -aspect 16:9 -c:a aac -strict experimental -b:a 192k -flags -global_header -f segment -segment_format mpegts -segment_list_type m3u8 -segment_list /var/www/html/CINEMAX.m3u8 -segment_time 5 -segment_list_flags +live -segment_wrap 6 -segment_time 10 /var/www/html/CINEMAX-%00d.ts
At second one, subtitles are little low than the first one: https://preview.ibb.co/e6VaVQ/2.jpg Second code
ffmpeg -i http://localhost:9099/play/a07w -metadata title="Cinemax" -filter_complex "[0:s:0] scale=-1:500 [sub],[0:v][sub] overlay=x=30:y=-1" -c:v libx264 -crf 20 -preset veryfast -aspect 16:9 -c:a aac -strict experimental -b:a 192k -flags -global_header -f segment -segment_format mpegts -segment_list_type m3u8 -segment_list /var/www/html/CINEMAX.m3u8 -segment_time 5 -segment_list_flags +live -segment_wrap 6 -segment_time 10 /var/www/html/CINEMAX-%00d.ts
And the third one they are at the bottom: https://preview.ibb.co/hyZfx5/3.jpg
nohup ffmpeg -i http://localhost:9099/play/a07w -metadata title="Cinemax" -filter_complex "[0:s:0] scale=-1:500 [sub],[0:v][sub] overlay=x=15:y=80" -c:v libx264 -crf 20 -preset veryfast -aspect 16:9 -c:a aac -strict experimental -b:a 192k -flags -global_header -f segment -segment_format mpegts -segment_list_type m3u8 -segment_list /var/www/html/CINEMAX.m3u8 -segment_time 5 -segment_list_flags +live -segment_wrap 6 -segment_time 10 /var/www/html/CINEMAX-%00d.ts > /dev/null 2>&1
The scale option is for scaling "the font size", and it's depend from video resolution.
The current running and tested version: ffmpeg version 3.3.2-1~14.04.york1 Copyright (c) 2000-2017 the FFmpeg developers
来源:https://stackoverflow.com/questions/41103786/ffmpeg-and-dvb-subtitles-scaling