Adding srt support in php for mencoder

Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: Adding srt support in php for mencoder

Post by Mysoogal » Wed Jan 13, 2010 12:38 am

Neo wrote:For ISO 639 codes, have a look at this link.
For English, this is eng. So you could add the switch as -slang eng

Is it required to call flvtool2 with a pipe? Can we just call it after ffmpeg ?

In mencoder, you miss to put a quote before -subfont.

i've just tested this not seem to work , not really about flvtool2 dont think to much about it :geek: i was just wondering if it was going to work adding that | or && like in wget :D

it looks right to me any issues here

Code: Select all

$cmd = 'ffmpeg -i '.$in.' -f mp4 -vcodec -newsubtitle '.$in_sub.' -slang eng mpeg4 -r 25 -b 560000 -s 610x340 -acodec aac -ac 2 -ab 64 -ar 44100 '.$out_vid.  ;

 
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Adding srt support in php for mencoder

Post by Neo » Wed Jan 13, 2010 12:56 am

Two issues.
1. Remove dot (.) before semicolon at the end of line
2. -vcodec mpeg4 should come together

Corrected line is given below.

Code: Select all

$cmd = 'ffmpeg -i '.$in.' -f mp4 -vcodec mpeg4 -newsubtitle '.$in_sub.' -slang eng -r 25 -b 560000 -s 610x340 -acodec aac -ac 2 -ab 64 -ar 44100 '.$out_vid;
 
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: Adding srt support in php for mencoder

Post by Mysoogal » Wed Jan 13, 2010 1:15 am

Neo wrote:Two issues.
1. Remove dot (.) before semicolon at the end of line
2. -vcodec mpeg4 should come together

Corrected line is given below.

Code: Select all

$cmd = 'ffmpeg -i '.$in.' -f mp4 -vcodec mpeg4 -newsubtitle '.$in_sub.' -slang eng -r 25 -b 560000 -s 610x340 -acodec aac -ac 2 -ab 64 -ar 44100 '.$out_vid;
 
thanks neo, but i couldn't get it to work even after typing it on ssh to test it

i've done something dirty lol i used mkvmerge like this

Code: Select all

$cmd = 'mkvmerge -o '.$out_vid.' '.$in_sub.' '.$in.' '; 
its not really what im after but it does mux the srt to mkv :mrgreen:

Code: Select all



FFmpeg version SVN-r21123, Copyright (c) 2000-2010 Fabrice Bellard, et al.
  built on Jan 10 2010 14:15:54 with gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
  configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --ena                                   ble-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libopencore-                                   amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libx264 --enable-libxvid --                                   enable-x11grab
  libavutil     50. 7. 0 / 50. 7. 0
  libavcodec    52.46. 0 / 52.46. 0
  libavformat   52.46. 0 / 52.46. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 8. 0 /  0. 8. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'unidtf.xvid-lpd.avi':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf52.46.0
  Duration: 00:07:19.94, start: 0.000000, bitrate: 571 kb/s
    Stream #0.0(und): Video: mpeg4, yuv420p, 610x340 [PAR 255:254 DAR 915:508], 564 kb/s                                   , 25 tbr, 25 tbn, 25 tbc
    Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 2 kb/s
At least one output file must be specified
root@mysoogal-1:/var/www#


Code: Select all

$cmd = 'ffmpeg -i '.$in.' -f mp4 -vcodec mpeg4 -newsubtitle '.$in_sub.' -slang eng -r 25 -b 560000 -s 610x340 -acodec aac -ac 2 -ab 64 -ar 44100 '.$out_vid;

 
do the '.$in_sub.' need be changed like this '.$in_sub' without .dot ? confused here
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Adding srt support in php for mencoder

Post by Neo » Wed Jan 13, 2010 1:28 am

No.it is correct to have a dot after $n_sub as there is a string to be concatenated after that.
You just need to understand that dot (.) is used to concatenate strings in php.

I do not see any problem there unless there is problem with flags. Just try to execute this in command prompt if possible.
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: Adding srt support in php for mencoder

Post by Mysoogal » Wed Jan 13, 2010 1:35 am

same return :cry:
root@mysoogal-1:/var/www# ffmpeg -i unidtf.xvid-lpd.avi -f mp4 -vcodec mpeg4 -newsubtitle unidtf.xvid-lpd.srt -slang eng -r 25 -b 560000 -s 610x340 -acodec aac -ac 2 -ab 64 -ar 44100 unidtf.xvid-lpd.mp4
FFmpeg version SVN-r21123, Copyright (c) 2000-2010 Fabrice Bellard, et al.
built on Jan 10 2010 14:15:54 with gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab
libavutil 50. 7. 0 / 50. 7. 0
libavcodec 52.46. 0 / 52.46. 0
libavformat 52.46. 0 / 52.46. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0. 8. 0 / 0. 8. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'unidtf.xvid-lpd.avi':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf52.46.0
Duration: 00:07:19.94, start: 0.000000, bitrate: 571 kb/s
Stream #0.0(und): Video: mpeg4, yuv420p, 610x340 [PAR 255:254 DAR 915:508], 564 kb/s, 25 tbr, 25 tbn, 25 tbc
Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 2 kb/s
At least one output file must be specified
strange i wonder if i can use another encoder such as avidmux but hmm maybe output mp4 not work in flash :cry:
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Adding srt support in php for mencoder

Post by Neo » Wed Jan 13, 2010 2:12 am

Shall we rename your file name unidtf.xvid-lpd to a Sample. It can be that the ffmpeg is confusing with dash (-) in the file name.
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: Adding srt support in php for mencoder

Post by Mysoogal » Wed Jan 13, 2010 2:37 am

i've changed to example.avi and example.srt same return

i think it has something to do with audio :cry: i will look for more ffmpeg examples for mp4
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: Adding srt support in php for mencoder

Post by Neo » Wed Jan 13, 2010 2:42 am

In that case try, -acodec mpeg4aac instead of -acodec aac
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: Adding srt support in php for mencoder

Post by Mysoogal » Wed Jan 13, 2010 2:57 am

Neo wrote:In that case try, -acodec mpeg4aac instead of -acodec aac
not even that seem to work

i try this one but not even this

Code: Select all

$cmd = 'ffmpeg -i '.$in.' -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -crf 22 -threads 0 -newsubtitle '.$in_sub.' '.$out_vid; 
when i remove the
-newsubtitle '.$in_sub.'
it will encode to mp4 but when i try to add the subtitle section it doesnt encode video :cry:

:cry: ffmpeg with srt is not simple i hate ffmeg now
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: Adding srt support in php for mencoder

Post by Mysoogal » Wed Jan 13, 2010 3:31 am

ok do not worry about it, i do not need help with ffmpeg and srt i find out u can load srt inside flash player swf so its ok no need to encode it with video, but strange that is doesnt work. :geek:

thanks neo for your help again like always

by the way neo why don't you change bbcode so it has this automatically

Code: Select all

 ?
Post Reply

Return to “PHP & MySQL”