[FFmpeg-user] Issue while burning text to a video , output is of hls and scaled

Aameer Rafiq Wani aameer.rafiq at gmail.com
Wed Feb 24 13:47:51 CET 2016


Hey Guys
I have been scratch my head on this. Let me start with my objective which
is:
1. to use ffmpeg to convert a video for now in mp4 format (preferably any
format in future) to 4 different versions
360, 480, 720, 1080
I also have to maintain the aspect ratio , so i can change the height and
calculate width accordingly.
I was able to do this with this bash script:

#!/bin/bash
#$VIDEO_ID = $1
#$INPUT_FILE_NAME = $2
#run script like this  e.g bash encoding_script.sh "3000"
"input_sintel_trailer_720p.mp4"

echo "The ffmpeg encoding is starting "

#for -profile:v details are here- https://trac.ffmpeg.org/wiki/Encode/H.264,
for other options check, ffmpeg -h

#360
mkdir -p ./videos/$1
ffmpeg -threads 4 -i $2 -profile:v baseline -level 4.0 -vf
scale="trunc(360*a/2)*2:360"  -start_number 0 -hls_time 10 -hls_list_size 0
-f hls videos/$1/index_$1_360_.m3u8

#480
ffmpeg -threads 4 -i $2 -profile:v baseline -level 4.0 -vf
scale="trunc(480*a/2)*2:480"  -start_number 0 -hls_time 10 -hls_list_size 0
-f hls videos/$1/index_$1_480_.m3u8

#720
ffmpeg -threads 4 -i $2 -profile:v baseline -level 4.0 -vf
scale="trunc(720*a/2)*2:720"  -start_number 0 -hls_time 10 -hls_list_size 0
-f hls videos/$1/index_$1_720_.m3u8

#1080
ffmpeg -threads 4 -i $2 -profile:v baseline -level 4.0 -vf
scale="trunc(1080*a/2)*2:1080"  -start_number 0 -hls_time 10 -hls_list_size
0 -f hls videos/$1/index_$1_1080_.m3u8

#creating a master playlist
echo "The ffmpeg encoding has ended\n"

cat << EOF > videos/$1/index_$1_master.m3u8
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1128000,RESOLUTION=640x360,CODECS="avc1.42001e,mp4a.40.2"
index_$1_360_.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1803000,RESOLUTION=854x480,CODECS="avc1.42001f,mp4a.40.2"
index_$1_480_.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=3138000,RESOLUTION=1280x720,CODECS="avc1.42001f,mp4a.40.2"
index_$1_720_.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=4865000,RESOLUTION=1920x1080,CODECS="avc1.420028,mp4a.40.2"
index_$1_1080_.m3u8
EOF

the next part of the problem is to add a indelible watermark  to the video
within a specified time interval. Now If I am correct I can achieve this in
many ways :

adding text over the video
adding subtitle over the video
or adding image over the video

the most promising among them seemed to be subtitles as if I am correct
would have allowed me to burn the text for at and for a specified time
interval but I wasnt able to achieve this I have tried many things like the
ones mentioned here in the stackoverflow question

http://stackoverflow.com/questions/35597083/how-to-build-ffmpeg-with-burn-text-on-hls-output-while-maintaining-the-aspect-ra

and the corresponding chat:

http://chat.stackoverflow.com/rooms/104392/discussion-between-aameer-and-mulvya

so In short I wasn't able to build the ffmpeg player properly and neither
did some of the static builds work for me as is explained in the
stack-overflow question.
one stackoverflow user (http://stackoverflow.com/users/5726027/mulvya) with
some command over ffmpeg was kind enough and tried to help me but we were
not able to achieve the given objective.I even tried to build ffmpeg myself
couple of times but again wasnt able to get a working solution (for the
drawtext or subtitles with scaled hls video output ) So this is call for
help to all of you guys. I have been stuck on this for a while.Would really
appreciate any help in this regard.


Thanks for reading such a long email but I wanted to make sure I explain
the problem to maximize the chances of a working response.

Thanks
-- 
Regards,
AAMEER RAFIQ WANI
email: aameer.rafiq at gmail.com
websites: aameer.github.io <aameer at github.io>
LinkedIn: http://in.linkedin.com/in/aameerwani
Current location: Bangalore  India.


More information about the ffmpeg-user mailing list