ffmpeg和dvb字幕缩放 [英] ffmpeg and dvb subtitles scaling
问题描述
我尝试对视频中的dvb字幕进行硬编码.我设法对其进行硬编码,但仍然放错了位置.原因是字幕的分辨率为SD分辨率720x576,而视频的分辨率为1920x1080.
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.
这是我的命令:
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.
推荐答案
preview.ibb.co/ibNB4k/1.jpg第一个代码
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
在第二个字幕中,字幕比第一个略低: https://preview.ibb.co/e6VaVQ/2.jpg 第二个密码
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
第三个位于底部: 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.
当前正在运行并经过测试的版本:ffmpeg版本3.3.2-1〜14.04.york1版权所有(c)2000-2017 FFmpeg开发人员
The current running and tested version: ffmpeg version 3.3.2-1~14.04.york1 Copyright (c) 2000-2017 the FFmpeg developers
这篇关于ffmpeg和dvb字幕缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!