FAQ  •  Register  •  Login

Subtitles on Sharp Aquos TV

<<

ArsenoLupino

Streaming enthusiast

Posts: 20

Joined: Fri Dec 23, 2011 6:27 pm

Post Fri Jan 06, 2012 7:21 pm

Subtitles on Sharp Aquos TV

Hello everyone.

I'm trying to figure out what can and cannot be done with subtitles on my Sharp Aquos TV. I understand that in all cases, subtitles have to be hard coded or burned into the video. Soft subtitles are not supported in any way.

I know how to hard code subtitles (SSA format) in an avi container with VirtualDub, but I have more problems with an MP4 container. I have this MP4 file (actually it was originally an m4v, but I changed the extension to mp4 as I'm a PC user) with subtitles in an SRT file. I've tried several programs and guides but nothing seems to work. Can anyone give me the trick?

Thanks!
<<

ArsenoLupino

Streaming enthusiast

Posts: 20

Joined: Fri Dec 23, 2011 6:27 pm

Post Tue Jan 10, 2012 3:07 am

Re: Subtitles on Sharp Aquos TV

My findings so far are as follows.

1. With .avi files, see the guide here: http://www.afterdawn.com/guides/archive/adding_subs_to_avi.cfm. I've tested this guide with two files and it works perfectly.

2. With .mp4 files, the only way I have found is to first convert the .mp4 file to .avi (xvid codec) with ImTOO Ultimate Video Converter. Then, follow the guide above. I tested this with one file and it worked very well. For a 2-hour movie, on a very average PC, it took about 3 hours for the mp4 => avi conversion and 2 hours to burn in the subtitles.

I only need subtitles for a small portion of the movies I watch, so I can live with the aggravation of having to hard code the subs. Ideally, this should be done in the transcoding process or, better yet, the TV should blend the subtitles on the fly.
<<

mxii

Serviio newbie

Posts: 5

Joined: Mon Nov 19, 2012 2:51 am

Post Mon Nov 19, 2012 3:52 am

Re: Subtitles on Sharp Aquos TV

Adding SRT subtitles during Serviio's Transcoding.
Tested with Serviio 1.0.1 on Debian with a Sharp Aquos TV.
Follow at your own risk.


1) Build ffmpeg with libass

On Debian follow http://wiki.serviio.org/doku.php?id=build_ffmpeg_linux:
  • During "Install Essential Build Tools and Libraries"
      Code:
    sudo apt-get install libass-dev

  • During "Build and Install FFmpeg" configure with this command instead
      Code:
    ./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-libvpx --enable-librtmp --enable-libxvid --enable-libass


2) Build a ffmpeg Wrapper

Save the following code to "ffmpeg_srt.c"
  Code:
#include <stdio.h>   // for printf
#include <stdlib.h>   // for system
#include <string.h>   // for str*, mem*
#include <unistd.h>   // for access

int main ( int argc, char *argv[] )
{
   int result = 1;
   size_t cbCommand = 12;   // ffmpeg_real
   char* pCommand = NULL;
   int iInput = 0;
   size_t cbSubtitle = 0;
   char* pSubtitle = NULL;
   size_t cbOutSub = 0;
   char* pOutSub = NULL;
   size_t cbConvert = 18;   // ffmpeg_real -i -y
   char* pConvert = NULL;
   int index = 0;
   
   // go through the arguments
   for( index = 1; index < argc; index++ )
   {
      
      // fix serviio h264 bug
      if ( 0 == strcmp( "h264", argv[index] ) )
      {
         argv[index] = "libx264";
      }
      
      cbCommand += strlen( argv[index] ) + 1;
      
      // is it the input flag?
      if ( 0 == strcmp( "-i", argv[index] ) )
      {
         iInput = index + 1;
      }
   }
   
   // only perform subtitle stuff if we found the input flag
   if ( iInput > 0 )
   {
      
      // determine subtitle name
      cbSubtitle = strlen( argv[iInput] );
      while ( cbSubtitle > 0 )
      {
         cbSubtitle--;
         if ( '.' == argv[iInput][cbSubtitle] )
         {
            break;
         }
      }
      if ( 0 == cbSubtitle )
      {
         cbSubtitle = strlen( argv[iInput] );
      }
      cbSubtitle += 5;
      pSubtitle = malloc( cbSubtitle );
      memcpy( pSubtitle, argv[iInput], cbSubtitle - 5 );
      pSubtitle[ cbSubtitle - 5 ] = '\0';
      strcat( pSubtitle, ".srt" );
      
      // only continue if subtitle exists
      if ( access( pSubtitle, F_OK ) != -1 )
      {
         
         // determine output subtitle name
         cbOutSub = strlen( argv[ argc - 1 ] );
         while ( cbOutSub > 0 )
         {
            cbOutSub--;
            if ( '.' == argv[ argc - 1 ][cbOutSub] )
            {
               break;
            }
         }
         if ( 0 == cbOutSub )
         {
            cbOutSub = strlen( argv[ argc - 1 ] );
         }
         cbOutSub += 5;
         pOutSub = malloc( cbOutSub );
         memcpy( pOutSub, argv[ argc - 1 ], cbOutSub - 5 );
         pOutSub[ cbOutSub - 5 ] = '\0';
         strcat( pOutSub, ".ass" );
         
         // make subtitle conversion command
         cbConvert += strlen( pSubtitle ) + 1;
         cbConvert += strlen( pOutSub ) + 1;
         pConvert = malloc( cbConvert );
         strcpy( pConvert, "ffmpeg_real -i " );
         strcat( pConvert, pSubtitle );
         strcat( pConvert, " -y " );
         strcat( pConvert, pOutSub );
         
         // run conversion
         result = system( pConvert );
         
         // add ass to command if successfully created
         if ( 0 == result )
         {
            cbCommand += 11;   // -vf "ass=<pOutSub>"
            cbCommand += strlen( pOutSub );
         }
      }
   }
   
   // put arguments back together
   pCommand = malloc( cbCommand );
   strcpy( pCommand, "ffmpeg_real" );
   for ( index = 1; index < argc; index++ )
   {
      strcat( pCommand, " " );
      strcat( pCommand, argv[index] );
      
      // insert subtitles?
      if ( ( index == iInput ) && ( NULL != pConvert ) && ( 0 == result ) )
      {
         strcat( pCommand, " -vf \"ass=" );
         strcat( pCommand, pOutSub );
         strcat( pCommand, "\"" );
      }
   }
   
   // run ffmpeg
   result = system( pCommand );
   
   // cleanup
   if ( pCommand != NULL )
   {
      free( pCommand );
   }
   if ( pSubtitle != NULL )
   {
      free( pSubtitle );
   }
   if ( pOutSub != NULL )
   {
      free( pOutSub );
   }
   if ( pConvert != NULL )
   {
      free( pConvert );
   }
   
   return result;
}


The above code needs to be compiled, ffmpeg needs to be renamed to ffmpeg_real and available in a "path" folder, and the compiled code needs to be moved into the old place of ffmpeg.

On Debian:
  Code:
sudo mv /usr/local/bin/ffmpeg /usr/local/ffmpeg_real
sudo gcc -o /usr/local/bin/ffmpeg ffmpeg_srt.c


3) Configure the Profile to Transcode All Videos

Add ' forceVTranscoding="true" ' to all video tags for the desired profile.

My Sharp Aquos Profile in profiles.xml:
  Code:
<Profile id="18" name="Sharp Aquos" extendsProfileId="1">
                <Detection>
                        <HttpHeaders>
                                <User-Agent>.*SHARP-AQUOS.*</User-Agent>
                        </HttpHeaders>
                </Detection>
                <MediaFormatProfiles>
                        <MediaFormatProfile mime-type="video/mpeg" name="MPEG_TS_SD_EU_ISO">AVC_TS_MP_HD_AC3_ISO</MediaFormatProfile>
                        <MediaFormatProfile mime-type="video/avi" name="">AVI</MediaFormatProfile>
                        <MediaFormatProfile mime-type="video/mp4">MPEG4_P2_3GPP_SP_L0B_AAC</MediaFormatProfile>
                        <MediaFormatProfile mime-type="video/mp4">MPEG4_P2_3GPP_SP_L0B_AMR</MediaFormatProfile>
                        <MediaFormatProfile mime-type="video/mp4">AVC_3GPP_BL_QCIF15_AAC</MediaFormatProfile>
                </MediaFormatProfiles>
                <Transcoding>
                        <Video targetContainer="mpegts" forceVTranscoding="true" targetACodec="ac3" aBitrate="384">
                                <Matches container="matroska" vCodec="h264"/>
                                <Matches container="flv" vCodec="h264"/>
                        </Video>
                        <Video targetContainer="mpegts" forceVTranscoding="true" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="384">
                                <Matches container="matroska" />
                                <Matches container="flv" />
                                <Matches container="wtv" />
                                <Matches container="mp4" />
                                <Matches container="asf" />
                        </Video>
                        <Audio targetContainer="lpcm">
                                <Matches container="asf" />
                                <Matches container="flac" />
                                <Matches container="ogg" />
                        </Audio>
                </Transcoding>
                <OnlineTranscoding>
                        <Video targetContainer="mpeg" targetVCodec="mpeg2video" targetACodec="ac3" aBitrate="384">
                                <Matches container="mp4" />
                        </Video>
                </OnlineTranscoding>
                <AutomaticImageRotation>true</AutomaticImageRotation>
                <LimitImageResolution>false</LimitImageResolution>
        </Profile>


Notes:

I swap out "h264" for "libx264" in the command line call of ffmpeg because ffmpeg does not recognize h264 as an encoder; libx264 is the encoder that handles h264.

I changed the second targetContainer to "mpegts" because the default "mpeg" caused my TV to skip exponentially more video.

This solution modifies ffmpeg globally. It only changes the transcoded video if there is a ".srt" file with the exact same path and name as the file, but there is no opt out. If this isn't desired you can use ffmpeg_real on the command line and point other applications to ffmpeg_real instead of ffmpeg.
If that isn't possible, this may not be the best solution for you.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17215

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Tue Nov 20, 2012 2:32 pm

Re: Subtitles on Sharp Aquos TV

Nice hack mxii. I'm looking at libass myself, as it looks the FFmpeg built solution might still take some time, and hope to bring it sometime after 1.1.
<<

hante

Serviio newbie

Posts: 6

Joined: Sat Apr 14, 2012 2:45 pm

Post Fri Nov 23, 2012 11:34 pm

Re: Subtitles on Sharp Aquos TV

Thank you so much mxii,

I've been waiting for this for quite some time now. Unfortunately I'm running Windows 7 so I had do my own wrapper. First of all this: the result is unacceptable for me. Somehow the audio gets screwed up and is 10 seconds ahead of video. But this maybe due to the way I transcode and the system I use, so who knows, maybe it is usable for somebody else. So here is still my progress. I used the mxii code and modified a few things. Compiled it with Visual Studio Express 12. The modified source is attached, but dont get upset. I made a mess of it and since it doesnt really work I didnt clean it anymore..

Unfortunately applying the libass filter under windows is not as straightforward as for linux so I had to make some code changes. Added some comment in code with explanation. Also using libass is not as easy under windows. So you have to do quite some work to get it to work, but here are the instructions:

Download the latest ffmpeg. I used static builds for x64, I suggest you use static and choose type 64bit or 32bit based upon your system. It has to be that latest, otherwise no libass. You can download them from here:

http://ffmpeg.zeranoe.com/builds/

Find the location where you have installed Serviio and look in the lib directory. There should be an executable ffmpeg.exe. Rename that to something like backup_ffmpeg.exe. It is not needed anymore but it is wise to keep a copy. You never know ;-)

Put the downloaded ffmpeg.exe in this lib direcorty and rename it to ffmpeg_real.exe. Be precise, it has to be exactly that name.

Attached is a zip file which contains source file, executable and fonts.conf. Put the executable and fonts.conf in the lib directory. The executable has exetension .binary (I was afraid that I wasnt allowed to upload it otherwise). Remove the .binary extension.

Now three important system settings have to be set. These are so-called Environemnt Variables and in Windows 7 you can find them in "System Properties" or "Advanced System Settings". The variables you have to set:

FC_CONFIG_DIR C:\Program Files\Serviio\lib
FONTCONFIG_FILE fonts.conf
FONTCONFIG_PATH C:\Program Files\Serviio\lib

Change the setting of FC_CONFIG_DIR andFONTCONFIG_PATH matching the directory where fonts.conf is located on your system.

That should be it. I hope I didn't forget anything. The startup of transcoding is a bit slower because ffmpeg will initially process the subtitles and this will take a couple of seconds.

Note: You can not have <space> " " in the path or filename of the file you want to transcode. Libass can not handle it.
Note: a temporary temp.ass file will be created in the lib directory. This is due to fact that paths in windows use ":" and libass sees that as seperator for options.
Note: I've not tested the x264 thingy. I dont use that in my profiles, so it might not work, just recoded it for wchar.
Note: Since I've not build any windows applications for a long time and certainly not with studio I really dont know if this x64 or 32bit app. If it is x64 and you 32bit then let me know. It should probably be possible to build a 32bit version :-)

For whom is interested. The biggest problem with using libass filter is that it is incapable of handling windows style filenames. It cant handle ":", it cant handle " ". So for mkv which are in a directory which contain spaces or have spaces the name this wrapper will not work.

good luck
Attachments
Serviio.zip
ffmpeg wrapper using libass for Windows including source code.
(19.79 KiB) Downloaded 467 times
<<

mmartins

Serviio newbie

Posts: 2

Joined: Wed Dec 05, 2012 12:28 am

Post Wed Dec 05, 2012 12:51 am

Re: Subtitles on Sharp Aquos TV

Thanks mxii!

I have your solution working fine with my bravia 2010 and serviio 1.01 running on ubuntu.
I had a few problems with spaces and other unusual characters in the filenames.
Another problem happend with my ffmpeg (version git-2012-10-23-d8f27ec), that for some files was showing the message:
  Code:
[Parsed_setdar_1 @ 0xabef680] num:den syntax is deprecated, please use num/den or named options instead

and then the subtitle was not added.
I had to change the profile, deleting the parameter DAR="16:9", which seemed to be related to the message.
I've tested various different formats, and all are showing subtitles correctly so far.

I hope this can be useful for other people around, until we have the official solution.
<<

hante

Serviio newbie

Posts: 6

Joined: Sat Apr 14, 2012 2:45 pm

Post Wed Dec 05, 2012 6:04 pm

Re: Subtitles on Sharp Aquos TV

The reason for your problem with DAR="16:9" is probably that it results in a "-vf" option for ffmpeg. And when this -vf option appears after the -vf option used to invoke libass then it will not work. Not sure if it is an ffmpeg problem or libass problem, but I think it is a libass problem. It can easily be solved in the wrapper.
<<

mmartins

Serviio newbie

Posts: 2

Joined: Wed Dec 05, 2012 12:28 am

Post Thu Dec 06, 2012 7:25 pm

Re: Subtitles on Sharp Aquos TV

OK, I see. The wrapper should be able to join all filters right after the -vf option.

Good news! Fresh information from ffmpeg.org :
https://ffmpeg.org/trac/ffmpeg/wiki/How ... he%20video
With recent versions (starting Nov 29th 2012) of FFmpeg, you can also simply use the subtitles filter:
ffmpeg -i video.avi -vf subtitles=subtitle.srt out.avi


Looks like we can do it in one single step now.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17215

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Thu Dec 06, 2012 8:07 pm

Re: Subtitles on Sharp Aquos TV

Yes, I'll try to implement this for 1.2. Although I think this filter only works with external subs, to burn subs included in the container (eg MKV) we will have to do 2 steps stil.
<<

mxii

Serviio newbie

Posts: 5

Joined: Mon Nov 19, 2012 2:51 am

Post Sat Dec 15, 2012 4:39 pm

Re: Subtitles on Sharp Aquos TV

Here is an updated version of my ffmpeg_srt.c.
  • It fixes the spaces and unusual characters in the filenames bug.
  • It fixes the problem where ass subtitles gets created when serviio is just extracting metadata.
  • It adds support for more subtitle file formats.

Note that it does not fix the above mentioned DAR problem, and it still uses two steps to convert non-ass subtitles.

ffmpeg_srt.c
  Code:
#include <stdio.h>   // for printf
#include <stdlib.h>   // for system
#include <string.h>   // for str*, mem*
#include <unistd.h>   // for access

// allow for easy turning on/off debug output
// uncomment to turn on
#define debug( ... )    //printf( __VA_ARGS__ )

int main ( int argc, char *argv[] )
{
   int result = 1;
   int iInput = 0;
   size_t cbSubtitle = 0;
   char* pSubtitle = NULL;
   size_t cbOutSub = 0;
   char* pOutSub = NULL;
   char* ppConArgs[6] = {NULL};
    pid_t pid = 0;
    char** ppCmdArgs = NULL;
   int index = 0;
    int outdex = 0;
   
   // go through the arguments
   for( index = 1; index < argc; index++ )
   {
      
      // fix serviio h264 bug
      if ( 0 == strcmp( "h264", argv[index] ) )
      {
         argv[index] = "libx264";
      }
      
      // is it the input flag?
      if ( 0 == strcmp( "-i", argv[index] ) )
      {
         iInput = index + 1;
      }
   }
   
   // only perform subtitle stuff if we found the input flag
    // and there is an output file specified (so that we don't create
    // subs when serviio is just extracting metadata)
   if ( ( iInput > 0 ) && ( iInput < argc - 1 ) )
   {
      
      // determine input subtitle name
      cbSubtitle = strlen( argv[iInput] );
      while ( cbSubtitle > 0 )
      {
         cbSubtitle--;
         if ( '.' == argv[iInput][cbSubtitle] )
         {
            break;
         }
      }
      if ( 0 == cbSubtitle )
      {
         cbSubtitle = strlen( argv[iInput] );
      }
      cbSubtitle += 6;
      pSubtitle = malloc( cbSubtitle );
      memcpy( pSubtitle, argv[iInput], cbSubtitle - 6 );
      pSubtitle[ cbSubtitle - 6 ] = '.';
      pSubtitle[ cbSubtitle - 5 ] = '\0';
      pSubtitle[ cbSubtitle - 4 ] = '\0';
      pSubtitle[ cbSubtitle - 3 ] = '\0';
      pSubtitle[ cbSubtitle - 2 ] = '\0';
      pSubtitle[ cbSubtitle - 1 ] = '\0';
       
        // check if ass/ssa already exists
      pSubtitle[ cbSubtitle - 5 ] = 'a';
      pSubtitle[ cbSubtitle - 4 ] = 's';
      pSubtitle[ cbSubtitle - 3 ] = 's';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            pOutSub = pSubtitle;
            result = 0;
            goto sub_done;
        }
      pSubtitle[ cbSubtitle - 5 ] = 's';
      pSubtitle[ cbSubtitle - 4 ] = 's';
      pSubtitle[ cbSubtitle - 3 ] = 'a';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            pOutSub = pSubtitle;
            result = 0;
            goto sub_done;
        }
       
        // find subs that need converting
        //
        // if it isn't listed by the command `ffmpeg -codecs | grep "^...S"`
        // then the block should be commented out as its not supported
       
        // Sub Rip --> *.srt
      pSubtitle[ cbSubtitle - 5 ] = 's';
      pSubtitle[ cbSubtitle - 4 ] = 'r';
      pSubtitle[ cbSubtitle - 3 ] = 't';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            goto sub_convert;
        }
       
        // Micro DVD --> *.sub
      pSubtitle[ cbSubtitle - 5 ] = 's';
      pSubtitle[ cbSubtitle - 4 ] = 'u';
      pSubtitle[ cbSubtitle - 3 ] = 'b';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            goto sub_convert;
        }
       
        // DivX --> *.xsub
      pSubtitle[ cbSubtitle - 5 ] = 'x';
      pSubtitle[ cbSubtitle - 4 ] = 's';
      pSubtitle[ cbSubtitle - 3 ] = 'u';
      pSubtitle[ cbSubtitle - 2 ] = 'b';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            goto sub_convert;
        }
       
        // SAMI --> *.sami, *.smi
      pSubtitle[ cbSubtitle - 5 ] = 's';
      pSubtitle[ cbSubtitle - 4 ] = 'a';
      pSubtitle[ cbSubtitle - 3 ] = 'm';
      pSubtitle[ cbSubtitle - 2 ] = 'i';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            goto sub_convert;
        }
      pSubtitle[ cbSubtitle - 5 ] = 's';
      pSubtitle[ cbSubtitle - 4 ] = 'm';
      pSubtitle[ cbSubtitle - 3 ] = 'i';
      pSubtitle[ cbSubtitle - 2 ] = '\0';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            goto sub_convert;
        }
       
        // Real Text --> *.rt
      pSubtitle[ cbSubtitle - 5 ] = 'r';
      pSubtitle[ cbSubtitle - 4 ] = 't';
      pSubtitle[ cbSubtitle - 3 ] = '\0';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            goto sub_convert;
        }
       
        // Presentation Graphic Stream --> *.sup
      pSubtitle[ cbSubtitle - 5 ] = 's';
      pSubtitle[ cbSubtitle - 4 ] = 'u';
      pSubtitle[ cbSubtitle - 3 ] = 'p';
      pSubtitle[ cbSubtitle - 2 ] = '\0';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            goto sub_convert;
        }
       
        // JACO Sub Script --> *.jss
      pSubtitle[ cbSubtitle - 5 ] = 'j';
      pSubtitle[ cbSubtitle - 4 ] = 's';
      pSubtitle[ cbSubtitle - 3 ] = 's';
      pSubtitle[ cbSubtitle - 2 ] = '\0';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            goto sub_convert;
        }
      
        // no external subs
        goto sub_done;
sub_convert:
       
        // determine output subtitle name
      cbOutSub = strlen( argv[ argc - 1 ] );
      while ( cbOutSub > 0 )
      {
         cbOutSub--;
         if ( '.' == argv[ argc - 1 ][cbOutSub] )
         {
            break;
         }
      }
      if ( 0 == cbOutSub )
      {
         cbOutSub = strlen( argv[ argc - 1 ] );
      }
      cbOutSub += 5;
      pOutSub = malloc( cbOutSub );
      memcpy( pOutSub, argv[ argc - 1 ], cbOutSub - 5 );
      pOutSub[ cbOutSub - 5 ] = '\0';
      strcat( pOutSub, ".ass" );
         
      // make subtitle conversion command
      ppConArgs[0] = "ffmpeg_real";
        ppConArgs[1] = "-i";
      ppConArgs[2] = pSubtitle;
      ppConArgs[3] = "-y";
      ppConArgs[4] = pOutSub;
      ppConArgs[5] = 0;
      
      // run conversion
        pid = fork();
        if ( 0 == pid )
        {
            result = execv( "/usr/local/bin/ffmpeg_real", ppConArgs );
            return result;
        }
        else if ( 0 < pid )
        {
            wait(&result);
            if ( 0 == WEXITSTATUS(result) )
            {
                result = 0;
            }
        }
   }
sub_done:
   
   debug( "Input:\n    File: %s\n    Subtitle: %s\nOutput:\n    File: %s\n    Subtitle: %s\nCommand(s):\n    %s %s %s %s %s\n    %s", argv[iInput], pSubtitle, argv[ argc - 1 ], ( pSubtitle == pOutSub )? NULL : pOutSub, ppConArgs[0], (ppConArgs[0] == NULL)? "" : ppConArgs[1], (ppConArgs[0] == NULL)? "" : ppConArgs[2], (ppConArgs[0] == NULL)? "" : ppConArgs[3], (ppConArgs[0] == NULL)? "" : ppConArgs[4], "ffmpeg_real" );
   
   // put arguments back together
   ppCmdArgs = malloc( sizeof(char*) * ( argc + ( (( NULL != pOutSub ) && ( 0 == result ))? 2 : 0 ) + 1 ) );
    ppCmdArgs[outdex++] = "ffmpeg_real";
   for ( index = 1; index < argc; index++ )
   {
      ppCmdArgs[outdex++] = argv[index];
        debug( " %s", argv[index] );
      
      // insert subtitles?
      if ( ( index == iInput ) && ( NULL != pOutSub ) && ( 0 == result ) )
      {
            ppCmdArgs[outdex++] = "-vf";
            ppCmdArgs[outdex] = malloc( 7 + strlen(pOutSub) );
         strcpy( ppCmdArgs[outdex], "ass='" );
         strcat( ppCmdArgs[outdex], pOutSub );
         strcat( ppCmdArgs[outdex++], "'" );
            debug( " -vf %s", ppCmdArgs[outdex-1] );
      }
   }
    debug( "\n" );
   
   // cleanup
   if ( ( pOutSub != NULL ) && ( pOutSub != pSubtitle ) )
   {
      free( pOutSub );
   }
   if ( pSubtitle != NULL )
   {
      free( pSubtitle );
   }
   
   // run ffmpeg replacing this process
   result = execv( "/usr/local/bin/ffmpeg_real", ppCmdArgs );
   
    // should not happen if execv fails
   return result;
}

<<

kaisersoze

Streaming enthusiast

Posts: 25

Joined: Wed Apr 18, 2012 4:20 pm

Post Sun Dec 23, 2012 1:43 pm

Re: Subtitles on Sharp Aquos TV

mxii which Sharp Aquos do you have? Mine is LE924E.
Do you have option to Fast forward during movie playback?
I don't have that option I've only option Jump Forward and it does not working well.

Subtitles:
compiled newest ffmpeg with --enable-libass option everything is working well.

But after manually executing ffmpeg -i video.avi -vf subtitles=subtitle.srt out.avi getting following error:
timebase 208333/5000000 not supported by MPEG 4 standard, the maximum admitted value for the timebase denominator is 65535

Setting -r 25 before the outfile param - this sets the framerate to the ffmpeg default.

New avi is created but video is poor quality, some characters are missing and without possibility to jump, forward or anything else with video.
<<

mxii

Serviio newbie

Posts: 5

Joined: Mon Nov 19, 2012 2:51 am

Post Tue Dec 25, 2012 3:41 am

Re: Subtitles on Sharp Aquos TV

LE640U
No fast forward or rewind, but it does have skip ahead and skip back.

Whenever I use ffmpeg without specifying codecs et al, it seems to loose quality from the original.
I usually just use whatever arguments Serviio chooses for ffmpeg.
Though, I had to delete the first video transcoding section above; the tv couldn't understand files that were left as h264.

Also, I was playing around with the latest ffmpeg and found that the argument '-sameq' that Serviio uses was dropped.
Simply leaving it out results in low quality video that looks blocky.
Replacing it with '-q:v 2' seems to fix it.
<<

mxii

Serviio newbie

Posts: 5

Joined: Mon Nov 19, 2012 2:51 am

Post Mon Jan 21, 2013 2:00 am

Re: Subtitles on Sharp Aquos TV

One more update to the wrapper.
It should now be compilable in Windows; allow space, colon, etc. in the pathnames; and support the new ffmpeg subtitles filter if compiled for it.

ffmpeg_srt.c
  Code:
//==============================================================================
// FFMPEG SRT Wrapper
//
// File: ffmpeg_srt.c
//
// Description:
//     A ffmpeg wrapper that automatically alters the ffmpeg command to include
//     burning subtitles into the video if they are available.
//     This program was designed to help the DLNA Server Serviio on debian
//     pass subtitles to dlna video clients.
//
//
// History:
//   Version 3 (20/01/13)
//     - Add support for the ffmpeg subtitles filter so that newer ffmpeg
//       builds don't need to convert subtitles in a separate command.
//     - Moved insertion of the subtitle filter from just after the input to
//       just after the other video filters so that colons (:) in other filters
//       don't cause errors.
//     - Fix Serviio using sameq.
//     - Adds Windows support.
//     - Escapes '\\', '[', ']', ''', ',', and ':' in subtitle filenames.
//
//   Version 2 (15/12/12)
//     - Allows the wrapper to be used with files that contain spaces and/or
//       other characters that the system shell considers special.
//     - Limits performing subtitle conversion to ffmpeg commands that will
//       result in video transcoding.
//     - Adds support for more external subtitle file formats:
//       ass, ssa, sub, xsub, sami, smi, rt, sub, jss
//
//   Version 1 (19/11/12)
//     - Initial Version with support for srt subtitle files.
//     - Includes fix for Serviio using h264.
//------------------------------------------------------------------------------

// includes
#include <stdio.h>      // for printf
#include <stdlib.h>     // for malloc, free, WEXITSTATUS
#include <string.h>     // for str*, mem*

// Windows Includes
#ifdef _WIN32
#include <io.h>         // for access
#include <process.h>    // for spawnv
#include <windows.h>    // because windows needs help

// Linux Includes
#else
#include <unistd.h>     // for access, execv, fork

#endif


//==============================================================================
// Wrapper Configuration
//------------------------------------------------------------------------------

// Real FFMPEG
//     The command to run the real ffmpeg executable.
#define FFMPEG_REAL "ffmpeg_real"
//                  "C:\\Program Files\\Serviio\\lib\\ffmpeg_real.exe"

// FFMPEG Has h264:
//     If uncommented, the wrapper will not replace occurrances of h264 in the
//     ffmpeg command with libx264. Note that the serviio recommended version
//     of ffmpeg does not recognize h264 as a valid codec.
//#define FFMPEG_HAS_H264 1

// FFMPEG Has sameq
//     If uncommented, the wrapper will not replace occurances of -sameq in the
//     ffmpeg command with -q:v 2. Note that only older versions of ffmpeg
//     supports the sameq flag, however, as of serviio v1.0.1, the serviio
//     recommended version of ffmpeg is still old enough to support it.
//#define FFMPEG_HAS_SAMEQ 1

// FFMPEG Has Subtitles
//     If uncommented, the wrapper will not perform subtitle conversion to ass.
//     This will result in using the subtitles filter instead of the ass filter.
//     Only newer versions (post 29/11/12) of ffmpeg supports the subtitles
//     filter. Use 'ffmpeg -filters' to see if subtitles is supported.
//#define FFMPEG_HAS_SUBTITLES 1

// FFMPEG Subtitles Support
//     If uncommented, each define enables support for the associated subtitles
//     file format. Use 'ffmpeg -codecs | grep "^...S"' to determine which
//     formats are supported.
#define FFMPEG_SUBS_SUBRIP   1      // Sub Rip --> *.srt
#define FFMPEG_SUBS_MICRODVD 1      // Micro DVD --> *.sub
#define FFMPEG_SUBS_DIVX     1      // DivX --> *.xsub
#define FFMPEG_SUBS_SAMI     1      // SAMI --> *.sami, *.smi
#define FFMPEG_SUBS_REALTEXT 1      // Real Text --> *.rt
#define FFMPEG_SUBS_PGS      1      // Presentation Graphic Stream --> *.sup
#define FFMPEG_SUBS_JACO     1      // JACO Sub Script --> *.jss

// Debug Output:
//     If uncommented, the input file, detected input subtitle, output file(s),
//     and executed commands will be outputted to stderr.
//#define DEBUG_OUTPUT 1


//==============================================================================
// Helpers
//------------------------------------------------------------------------------

// allow for easy turning on/off debug output
#ifdef DEBUG_OUTPUT
#define debug( ... )    fprintf( stderr, __VA_ARGS__ )
#else
#define debug( ... )
#endif

// fix access for Windows
#ifdef _WIN32
#define F_OK 0
#define access _access
#endif

// hide Windows unsafe warnings
#ifdef _WIN32
#pragma warning(disable: 4996)
#endif

// run a command until its finished
int runCommand ( char* command, char** args, int bReplace )
{
    int result = 0;
   
    // Windows
    #ifdef _WIN32
        int mode = _P_WAIT;     // execution mode
        char* pQuoted = NULL;
   
        // do we want to replace this process?
        if ( bReplace )
        {
            mode = _P_OVERLAY;
        }

        // windows is horrible requiring quoting everything...
        // luckily it doesn't allow quotes in filenames
        while ( args[result] )
        {
            if ( strchr( args[result], ' ' ) )
            {
                pQuoted = malloc( strlen( args[result] ) + 3 );
                if ( NULL != pQuoted )
                {
                    pQuoted[0] = '"';
                    pQuoted[1] = 0;
                    strcat( pQuoted, args[result] );
                    strcat( pQuoted, "\"" );
                    args[result] = pQuoted;
                }
                else
                {
                    fprintf( stderr, "ffmpeg_srt: ERROR: Quote Failed!" );
                }
            }
            result++;
        }
           
        // run the command
        result = _spawnv( mode, command, args );
   
        // create process failed?
        if ( 0 > result )
        {
            fprintf( stderr, "ffmpeg_srt: ERROR: SPAWNV Failed!" );
        }
   
    // Linux
    #else
        pid_t pid = 0;                  // conversion process id
   
        // start another process?
        if ( !bReplace )
        {
            pid = fork();
        }
   
        // process to replace with the command (possibly a child)
        if ( 0 == pid )
        {
           
            // run the command
            result = execv( command, args );
            fprintf( stderr, "ffmpeg_srt: ERROR: EXECV FAILED!" );
        }
       
        // parent process
        else if ( 0 < pid )
        {
           
            // wait for the result
            wait( &result );
            if ( 0 == WEXITSTATUS( result ) )
            {
                result = 0;
            }
        }
   
        // fork failed
        else
        {
            fprintf( stderr, "ffmpeg_srt: ERROR: FORK FAILED!" );
            result = 3;
        }
    #endif
   
    return result;
}


//==============================================================================
// The Wrapper
//------------------------------------------------------------------------------

// main program
int main ( int argc, char *argv[] )
{
    int result = 1;
    int iInput = 0;             // index of the last input flag
    int iVF    = 0;             // index of the last video filter flag
    char* pSubtitle = NULL;     // input subtitle path
    size_t cbSubtitle = 0;      // size of pSubtitle in bytes
    char** ppCmdArgs = NULL;    // ffmpeg command arguments
    size_t cbCmdArgs = 0;       // sizeof ppCmdArgs in bytes
    int index = 0;
    int outdex = 0;
   
    // go through the arguments to determine the type of execution requested
    cbCmdArgs = sizeof(char*) * ( argc + 1 );
    for( index = 1; index < argc; index++ )
    {
        if ( 0 == strcmp( "-i", argv[index] ) )         // input flag
        {
            iInput = index + 1;
        }
        else if ( 0 == strcmp( "-vf", argv[index] ) )   // video filter flag
        {
            iVF = index + 1;
        }
        #ifndef FFMPEG_HAS_SAMEQ
            else if ( 0 == strcmp( "-sameq", argv[index] ) )    // -sameq flag
            {
                cbCmdArgs += sizeof(char*);
            }
        #endif
    }
    debug( "Input:\n    File: %s\n", argv[iInput] );
    if ( iVF < iInput )
    {
        iVF = iInput;
    }
   
    // only perform subtitle stuff if we found the input flag
    // and there is an output file specified (so that we don't create
    // subs when serviio is just extracting metadata)
    if ( ( iInput > 0 ) && ( iVF < argc - 1 ) )
    {
       
        // find the start of the input file's extension
        cbSubtitle = strlen( argv[iInput] );
        while ( cbSubtitle > 0 )
        {
            cbSubtitle--;
            if ( '.' == argv[iInput][cbSubtitle] )
            {
                break;
            }
        }
        if ( 0 == cbSubtitle )
        {
            cbSubtitle = strlen( argv[iInput] );
        }
       
        // copy the file path & name less extension
        cbSubtitle += 6;
        pSubtitle = malloc( cbSubtitle );
        memcpy( pSubtitle, argv[iInput], cbSubtitle - 6 );
        pSubtitle[ cbSubtitle - 6 ] = '.';
        pSubtitle[ cbSubtitle - 5 ] = '\0';
        pSubtitle[ cbSubtitle - 4 ] = '\0';
        pSubtitle[ cbSubtitle - 3 ] = '\0';
        pSubtitle[ cbSubtitle - 2 ] = '\0';
        pSubtitle[ cbSubtitle - 1 ] = '\0';
       
        // find the input subtitle file
       
        // Advanced SubStation Alpha --> *.ass, *.ssa
        pSubtitle[ cbSubtitle - 5 ] = 'a';
        pSubtitle[ cbSubtitle - 4 ] = 's';
        pSubtitle[ cbSubtitle - 3 ] = 's';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            result = 0;
            goto search_over;
        }
        pSubtitle[ cbSubtitle - 5 ] = 's';
        pSubtitle[ cbSubtitle - 4 ] = 's';
        pSubtitle[ cbSubtitle - 3 ] = 'a';
        if ( access( pSubtitle, F_OK ) != -1 )
        {
            result = 0;
            goto search_over;
        }
       
        // Sub Rip --> *.srt
        #ifdef FFMPEG_SUBS_SUBRIP
            pSubtitle[ cbSubtitle - 5 ] = 's';
            pSubtitle[ cbSubtitle - 4 ] = 'r';
            pSubtitle[ cbSubtitle - 3 ] = 't';
            if ( access( pSubtitle, F_OK ) != -1 )
            {
                goto search_over;
            }
        #endif
       
        // Micro DVD --> *.sub
        #ifdef FFMPEG_SUBS_MICRODVD
            pSubtitle[ cbSubtitle - 5 ] = 's';
            pSubtitle[ cbSubtitle - 4 ] = 'u';
            pSubtitle[ cbSubtitle - 3 ] = 'b';
            if ( access( pSubtitle, F_OK ) != -1 )
            {
                goto search_over;
            }
        #endif
       
        // DivX --> *.xsub
        #ifdef FFMPEG_SUBS_DIVX
            pSubtitle[ cbSubtitle - 5 ] = 'x';
            pSubtitle[ cbSubtitle - 4 ] = 's';
            pSubtitle[ cbSubtitle - 3 ] = 'u';
            pSubtitle[ cbSubtitle - 2 ] = 'b';
            if ( access( pSubtitle, F_OK ) != -1 )
            {
                goto search_over;
            }
        #endif
       
        // SAMI --> *.sami, *.smi
        #ifdef FFMPEG_SUBS_SAMI
            pSubtitle[ cbSubtitle - 5 ] = 's';
            pSubtitle[ cbSubtitle - 4 ] = 'a';
            pSubtitle[ cbSubtitle - 3 ] = 'm';
            pSubtitle[ cbSubtitle - 2 ] = 'i';
            if ( access( pSubtitle, F_OK ) != -1 )
            {
                goto search_over;
            }
            pSubtitle[ cbSubtitle - 5 ] = 's';
            pSubtitle[ cbSubtitle - 4 ] = 'm';
            pSubtitle[ cbSubtitle - 3 ] = 'i';
            pSubtitle[ cbSubtitle - 2 ] = '\0';
            if ( access( pSubtitle, F_OK ) != -1 )
            {
                goto search_over;
            }
        #endif
       
        // Real Text --> *.rt
        #ifdef FFMPEG_SUBS_REALTEXT
            pSubtitle[ cbSubtitle - 5 ] = 'r';
            pSubtitle[ cbSubtitle - 4 ] = 't';
            pSubtitle[ cbSubtitle - 3 ] = '\0';
            if ( access( pSubtitle, F_OK ) != -1 )
            {
                goto search_over;
            }
        #endif
       
        // Presentation Graphic Stream --> *.sup
        #ifdef FFMPEG_SUBS_PGS
            pSubtitle[ cbSubtitle - 5 ] = 's';
            pSubtitle[ cbSubtitle - 4 ] = 'u';
            pSubtitle[ cbSubtitle - 3 ] = 'p';
            pSubtitle[ cbSubtitle - 2 ] = '\0';
            if ( access( pSubtitle, F_OK ) != -1 )
            {
                goto search_over;
            }
        #endif
       
        // JACO Sub Script --> *.jss
        #ifdef FFMPEG_SUBS_JACO
            pSubtitle[ cbSubtitle - 5 ] = 'j';
            pSubtitle[ cbSubtitle - 4 ] = 's';
            pSubtitle[ cbSubtitle - 3 ] = 's';
            pSubtitle[ cbSubtitle - 2 ] = '\0';
            if ( access( pSubtitle, F_OK ) != -1 )
            {
                goto search_over;
            }
        #endif
       
        // no external subs
        free( pSubtitle );
        pSubtitle = NULL;
       
search_over:
        debug( "    Subtitle: %s\n", pSubtitle );
        debug( "Output:\n    File: %s\n", argv[ argc - 1 ] );
       
        // conversion needed?
        #ifndef FFMPEG_HAS_SUBTITLES
        if ( ( 1 == result ) && ( NULL != pSubtitle ) )
        {
            char* pOutSub = NULL;           // output subtitle path
            size_t cbOutSub = 0;            // size of pOutSub in bytes
            char* ppConArgs[6] = { NULL };  // conversion command arguments
           
            // find the start of the output file's extension
            cbOutSub = strlen( argv[ argc - 1 ] );
            while ( cbOutSub > 0 )
            {
                cbOutSub--;
                if ( '.' == argv[ argc - 1 ][cbOutSub] )
                {
                    break;
                }
            }
            if ( 0 == cbOutSub )
            {
                cbOutSub = strlen( argv[ argc - 1 ] );
            }
           
            // copy the file path and change the extension to ass
            cbOutSub += 5;
            pOutSub = malloc( cbOutSub );
            if ( NULL == pOutSub )
            {
                fprintf( stderr, "ffmpeg_srt: ERROR: OUT OF MEMORY!" );
                return 2;
            }
            memcpy( pOutSub, argv[ argc - 1 ], cbOutSub - 5 );
            pOutSub[ cbOutSub - 5 ] = '\0';
            strcat( pOutSub, ".ass" );
            debug( "    Subtitle: %s\n", pOutSub );
           
            // make the subtitle conversion command
            ppConArgs[0] = "ffmpeg";
            ppConArgs[1] = "-i";
            ppConArgs[2] = pSubtitle;
            ppConArgs[3] = "-y";
            ppConArgs[4] = pOutSub;
            ppConArgs[5] = 0;
            debug("Command(s):\n    ffmpeg -i %s -y %s\n", pSubtitle, pOutSub );
           
            // run the subtitle conversion in another process
            result = runCommand( FFMPEG_REAL, ppConArgs, 0 );
           
            // cleanup
            free( pSubtitle );
            pSubtitle = NULL;
            if ( 0 == result )
            {
                pSubtitle = pOutSub;
            }
            else
            {
                free( pOutSub );
            }
        }
        else
        #endif
           
        // no conversion
        {
            debug( "    Subtitle: %s\n", NULL );
            debug( "Command(s):\n    %s\n", NULL );
        }
       
        // subtitles to add?
        if ( NULL != pSubtitle )
        {
            cbCmdArgs += 2 * sizeof(char*);
           
            // sizeup subtitle string
            cbSubtitle = 0;
            index = 0;
            while ( 0 != pSubtitle[index] )
            {
                if  (
                        ( '\\' == pSubtitle[index] ) ||
                        ( '\'' == pSubtitle[index] ) ||
                        ( ':' == pSubtitle[index] ) ||
                        ( ',' == pSubtitle[index] ) ||
                        ( '[' == pSubtitle[index] ) ||
                        ( ']' == pSubtitle[index] )
                    )
                {
                    cbSubtitle += 3;
                }
                index++;
                cbSubtitle++;
            }
            cbSubtitle++;
        }
    }
   
    // reconstruct ffmpeg command
    ppCmdArgs = malloc( cbCmdArgs );
    if ( NULL == ppCmdArgs )
    {
        fprintf( stderr, "ffmpeg_srt: ERROR: OUT OF MEMORY!" );
        return 2;
    }
    ppCmdArgs[outdex++] = "ffmpeg";
    debug( "    ffmpeg" );
    for ( index = 1; index < argc; index++ )
    {
       
        // fix serviio h264 bug
        #ifndef FFMPEG_HAS_H264
            if ( 0 == strcmp( "h264", argv[index] ) )
            {
                ppCmdArgs[outdex++] = "libx264";
                debug( " libx264" );
            }
            else
        #endif
       
        // fix serviio sameq bug
        #ifndef FFMPEG_HAS_SAMEQ
            if ( 0 == strcmp( "-sameq", argv[index] ) )
            {
                ppCmdArgs[outdex++] = "-q:v";
                ppCmdArgs[outdex++] = "2";
                debug( " -q:v 2" );
            }
            else
        #endif
       
        // copy over argument
        {
            ppCmdArgs[outdex++] = argv[index];
            debug( " %s", argv[index] );
        }
       
        // insert subtitles?
        if ( ( index == iVF ) && ( NULL != pSubtitle ) )
        {
            ppCmdArgs[outdex++] = "-vf";
            #ifndef FFMPEG_HAS_SUBTITLES
                ppCmdArgs[outdex] = malloc( 4 + cbSubtitle );
                if ( NULL == ppCmdArgs[outdex] )
                {
                    fprintf( stderr, "ffmpeg_srt: ERROR: OUT OF MEMORY!" );
                    return 2;
                }
                strcpy( ppCmdArgs[outdex], "ass=" );
                cbSubtitle = 4;
            #else
                ppCmdArgs[outdex] = malloc( 10 + cbSubtitle );
                if ( NULL == ppCmdArgs[outdex] )
                {
                    fprintf( stderr, "ffmpeg_srt: ERROR: OUT OF MEMORY!" );
                    return 2;
                }
                strcpy( ppCmdArgs[outdex], "subtitles=" );
                cbSubtitle = 10;
            #endif
           
            // escape subtitle
            iInput = 0;
            while ( 0 != pSubtitle[iInput] )
            {
                if  (
                        ( '\\' == pSubtitle[iInput] ) ||
                        ( '\'' == pSubtitle[iInput] ) ||
                        ( ':'  == pSubtitle[iInput] ) ||
                        ( ','  == pSubtitle[iInput] ) ||
                        ( '['  == pSubtitle[iInput] ) ||
                        ( ']'  == pSubtitle[iInput] )
                    )
                {
                    ppCmdArgs[outdex][cbSubtitle++] = '\\';
                    ppCmdArgs[outdex][cbSubtitle++] = '\\';
                    ppCmdArgs[outdex][cbSubtitle++] = '\\';
                }
                ppCmdArgs[outdex][cbSubtitle++] = pSubtitle[iInput++];
            }
            ppCmdArgs[outdex++][cbSubtitle++] = 0;
            debug( " -vf %s", ppCmdArgs[outdex-1] );
        }
    }
    ppCmdArgs[outdex] = 0;
    debug( "\n" );
   
    // cleanup
    if ( NULL != pSubtitle )
    {
        free( pSubtitle );
    }
   
    // run ffmpeg replacing this process if possible
    result = runCommand( FFMPEG_REAL, ppCmdArgs, 1 );
    return result;
}

//==============================================================================

<<

fri.K

Serviio newbie

Posts: 3

Joined: Tue Jan 22, 2013 10:14 pm

Post Tue Jan 22, 2013 10:32 pm

Re: Subtitles on Sharp Aquos TV

In first place hi to all, and sorry for bad English :)
@mxii I have just tested your code and .. it's working. But I don't understand why do You brake original ffmpeg binary? I just copied binary ffmpeg_srt to /usr/bin and in You code changed
  Code:
#define FFMPEG_REAL "ffmpeg_real"
to
  Code:
#define FFMPEG_REAL "/usr/bin/ffmpeg"
Then just point serviio.sh to run Your special bin by editing serviio.sh and in line
  Code:
JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dderby.system.home=$SERVIIO_HOME/library -Dserviio.home=$SERVIIO_HOME"
add variable ffmpeg.location so at the end it will be for me
  Code:
JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.awt.headless=true -Dderby.system.home=$SERVIIO_HOME/library -Dserviio.home=$SERVIIO_HOME -Dffmpeg.location=/usr/bin/ffmpeg_srt"

So we do not broke anything in system, and have fully working subtitles.Paths to ffmpeg are for my OS which is Fedora 17.

Now, the problem. When I play video on PS3 it only accepts subtitles with format
  Code:
1
00:01:36,888 --> 00:01:38,347
[PA BEEPS]

2
00:01:39,682 --> 00:01:41,183
PILOT [OVER PA]:
Ladies and gentlemen...

and doesn't accept with this format:
  Code:
[847][875]Something to say
[1002][1012]Another line to say,

Both are with *.srt extension and it doesn't care if it's real file or symlink. What can I do with that?
<<

wojtas40

Streaming enthusiast

Posts: 22

Joined: Sun Jan 08, 2012 11:45 am

Post Wed Jan 23, 2013 6:09 pm

Re: Subtitles on Sharp Aquos TV

Hello,

Could somebody attach a "ready-to-go" solution? I'm not a developer....

I've tried to use your solutions but I've failed.

The best solution would be this with newest ffmpeg from net (I don't know where to put those command lines to force FF to create subs), mentioned in mmartins's post.

Wojtek
<<

fri.K

Serviio newbie

Posts: 3

Joined: Tue Jan 22, 2013 10:14 pm

Post Wed Jan 23, 2013 8:28 pm

Re: Subtitles on Sharp Aquos TV

@wojtas40 Cześć ;)
If your OS is Linux ex. Fedora:
1. Open terminal and past
  Code:
touch ffmpeg_src.c

2. Open ffmpeg_src.c in some text editor (ex.
  Code:
gedit ffmpeg_srt.c

3. Past source code mentioned here with one change mentioned by me here
4. Close editor and run
  Code:
gcc ffmpeg_srt.c -o ffmpeg_srt
(remember, you mast have installed gcc)
5. Move binary to your ffmpeg bin path
  Code:
sudo mv ffmpeg_srt /usr/bin
To find this path just run
  Code:
which ffmpeg

6. In serviio bin directory edit files as I mentioned here, and create profile as mentioned here

To know if you must recompile ffmpeg just run
  Code:
ffmpeg
and see if you have enabled libass. In Fedora there is no need to recompile:
  Code:
$ ffmpeg
ffmpeg version 0.10.6 Copyright (c) 2000-2012 the FFmpeg developers
  built on Oct 31 2012 22:24:06 with gcc 4.7.2 20120921 (Red Hat 4.7.2-2)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
Hyper fast Audio and Video encoder
<<

wojtas40

Streaming enthusiast

Posts: 22

Joined: Sun Jan 08, 2012 11:45 am

Post Wed Jan 23, 2013 9:06 pm

Re: Subtitles on Sharp Aquos TV

I forgot to say - I see Windows 7 :)
<<

fri.K

Serviio newbie

Posts: 3

Joined: Tue Jan 22, 2013 10:14 pm

Post Thu Jan 24, 2013 6:34 am

Re: Subtitles on Sharp Aquos TV

@wojtas40 Oh, sorry then. I don't have any computer with Windows OS. You must wait for someone's else help. Regards
<<

wojtas40

Streaming enthusiast

Posts: 22

Joined: Sun Jan 08, 2012 11:45 am

Post Thu Jan 24, 2013 12:48 pm

Re: Subtitles on Sharp Aquos TV

Help, help! :)

Could anybody attach built and prepared (for .srt) FF? (for Windows)

Or show how (where) to use command line with the newest FF which has ability to create subtitles.
<<

wojtas40

Streaming enthusiast

Posts: 22

Joined: Sun Jan 08, 2012 11:45 am

Post Wed Jan 30, 2013 9:00 pm

Re: Subtitles on Sharp Aquos TV

wojtas40 wrote:Help, help! :)

Could anybody attach built and prepared (for .srt) FF? (for Windows)

Or show how (where) to use command line with the newest FF which has ability to create subtitles.


Please help
Next

Return to Serviio Support & Help

Who is online

Users browsing this forum: No registered users and 77 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.