Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How embed subtitle in movie's file with avidemux?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Mon Apr 06, 2015 8:48 am    Post subject: How embed subtitle in movie's file with avidemux? Reply with quote

I want to stream movies from PC to TV -
I have DLNA and also can do it by nfs/mounting from sat receiver to PC through LAN, and it works ok.
However, I do not have any feature of those two applications (DLNA & NFS/mounting), that enables adding subtitles to movies.
So, I need application that can embed subtitle and creates new movie's file (with subtitle included).
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”


Last edited by pmam on Mon Apr 20, 2015 10:47 am; edited 3 times in total
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Mon Apr 06, 2015 2:58 pm    Post subject: Reply with quote

you can do that with:
mencoder -o outfile infile -sub subtitle.srt -subcp utf8 -font fontfile -ovc codec
fontfile sample: /usr/share/fonts/dejavu/DejaVuSans.ttf

what is problematic?
you have many format for subtitle file, one of them is that subtitle aren't even text, but picture holding the text
so you need to extract the subtitle first, and it depend on the container and the subtitle format they use.
for mkv you can look at media-video/mkvtoolnix that have an mkvextract tool to do that.
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Tue Apr 07, 2015 2:47 pm    Post subject: Reply with quote

krinn,

I see that in order to have mencoder, need to re-emerge mplayer with 'encode' USE flag - Right?
In general, I use text subtitles - I mean - I can open it with text editors and see the content -
so hope, no need to extract.But I am quite surprised to see that there is no such GUI tool,
that enables to edit the movie file and embed subtitle -
long ago I used to do it with windows and there were many of that.
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
Apheus
Guru
Guru


Joined: 12 Jul 2008
Posts: 422

PostPosted: Tue Apr 07, 2015 2:57 pm    Post subject: Reply with quote

I did it one time with avidemux. But that was long ago.

media-video/avidemux.

Open the movie file. In "Video" section: Change video output from "Copy" to your prefered encoder. In "Filters" there should be a filter to add a subtitle from a .srt file to the movie. Select and configure the filter. And "Save" asks for a filename and transcodes the movie.
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Tue Apr 07, 2015 5:27 pm    Post subject: Reply with quote

Apheus Hi,

I installed media-video/avidemux and it looks very nice tool,
but there is nothing in "Filters" for subtitle - it is empty??
BTW: If I choose "copy" I guess it keeps the original encoder?

Thanks
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
Apheus
Guru
Guru


Joined: 12 Jul 2008
Posts: 422

PostPosted: Tue Apr 07, 2015 5:54 pm    Post subject: Reply with quote

pmam wrote:
there is nothing in "Filters" for subtitle - it is empty?


After loading an input file, and changing "Video output" to "Mpeg4-ASP (ff)", I see one filter in the category "Subtitles": "SSA/ASS/SRT: Hardcode ass/ssa/srt subtitles using libass".

I have the use flag "libass" set globally, maybe you need it. My use flags for relevant packages:

Code:
[ebuild   R    ] media-video/ffmpeg-1.2.6-r1  USE="X aac alsa amr bluray bzip2 encode fontconfig gnutls gsm hardcoded-tables iconv jpeg2k libass libcaca modplug mp3 network openal opus pic schroedinger sdl speex theora threads truetype vdpau vorbis vpx x264 xvid zlib -aacplus (-altivec) -cdio (-celt) -cpudetection -debug -doc -examples -faac -fdk -flite -frei0r -iec61883 -ieee1394 -jack -libsoxr -libv4l (-neon) -openssl -oss -pulseaudio -rtmp -static-libs {-test} -twolame -v4l -vaapi (-vis) (-bindist%)" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="mmx mmxext ssse3 -3dnow -3dnowext -avx" FFTOOLS="aviocat cws2fws ffescape ffeval fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart trasher" 0 KiB

[ebuild   R   ~] media-video/avidemux-2.6.8:2.6  USE="nls opengl qt4 sdl xv -debug -vaapi -vdpau" LINGUAS="de -ca -cs -el -es -fr -it -ja -pt_BR -ru -sr -sr@latin -tr" VIDEO_CARDS="-fglrx"

[ebuild   R   ~] media-libs/avidemux-core-2.6.8:2.6  USE="nls sdl xv -debug (-system-ffmpeg) -vaapi -vdpau" VIDEO_CARDS="-fglrx" 0 KiB

[ebuild   R   ~] media-libs/avidemux-plugins-2.6.8:2.6  USE="a52 aac alsa amr dts fontconfig lame opengl qt4 truetype vorbis vpx x264 xv xvid -aften -debug -fribidi -jack -libsamplerate -oss -pulseaudio -twolame -vdpau" CPU_FLAGS_X86="mmx" PYTHON_TARGETS="python2_7" 0 KiB


My guess is you have to recompile media-video/ffmpeg with USE="libass".

pmam wrote:
If I choose "copy" I guess it keeps the original encoder?


You cannot embed subtitles without reencoding, so "copy" is not an option here. It means "copy the video part of the demuxed stream unmodified", which is i.e. for adding an audio track.
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Wed Apr 08, 2015 9:40 am    Post subject: Reply with quote

Apheus,

I added USE="libass" globally (to make.conf) and updated the system but still category "Subtitles" is empty.
I wonder if need to add all your USE flags, or can you please advise particular ones?
BTW: How to print like your output that shows use flags for relevant packages?
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
Apheus
Guru
Guru


Joined: 12 Jul 2008
Posts: 422

PostPosted: Wed Apr 08, 2015 9:55 am    Post subject: Reply with quote

pmam wrote:
I wonder if need to add all your USE flags, or you can advise particular ones?


The only particular one which came to my mind was "libass". Other than that, I have no idea.

Quote:
BTW: How to print like your output that shows use flags for relevant packages?


Just ask emerge for a simulated remerge of the package with "verbose" option:

Code:
emerge -pv media-video/ffmpeg


Bonus points for copying that to the forums with the colors of set/unset useflags. I think I saw this once but I don't know how to do it.
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Wed Apr 08, 2015 10:27 am    Post subject: Reply with quote

Apheus,

Here my data - some USE flags missing, comparing to yours - need to check...
Also do not know if to add them globally or by package.use?
Hope someone can tell...

Code:
[ebuild   R   ~] media-video/ffmpeg-2.6.1:0/54.56.56  USE="X aac alsa bzip2 encode gpl hardcoded-tables iconv libass mp3 network opengl postproc sdl threads truetype vorbis x264 xcb xvid zlib -aacplus (-altivec) -amr -amrenc (-armv5te) (-armv6) (-armv6t2) (-armvfp) -bluray -bs2b -cdio -celt -cpudetection -debug -doc -examples -faac -fdk -flite -fontconfig -frei0r -fribidi -gme -gnutls -gsm -iec61883 -ieee1394 -jack -jpeg2k -ladspa -libcaca -libsoxr -libv4l -lzma (-mipsdspr1) (-mipsdspr2) (-mipsfpu) -modplug (-neon) -openal -openssl -opus -oss -pic -pulseaudio -quvi -rtmp -samba -schroedinger -speex -ssh -static-libs {-test} -theora -twolame -v4l -vaapi -vdpau -vpx -wavpack -webp -x265 -zvbi" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3 -3dnow -3dnowext -avx -avx2 -fma3 -fma4 -sse4_1 -sse4_2 -xop" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart trasher" 0 KiB


Code:
[ebuild   R   ~] media-video/avidemux-2.6.8:2.6  USE="nls opengl qt4 sdl xv -debug -vaapi -vdpau" LINGUAS="-ca -cs -de -el -es -fr -it -ja -pt_BR -ru -sr -sr@latin -tr" VIDEO_CARDS="-fglrx" 0 KiB


Code:
[ebuild   R   ~] media-libs/avidemux-core-2.6.8:2.6  USE="nls sdl xv -debug (-system-ffmpeg) -vaapi -vdpau" VIDEO_CARDS="-fglrx" 0 KiB


Code:
[ebuild   R   ~] media-libs/avidemux-plugins-2.6.8:2.6  USE="a52 aac alsa dts opengl qt4 truetype vorbis x264 xv xvid -aften -amr -debug -fontconfig -fribidi -jack -lame -libsamplerate -oss -pulseaudio -twolame -vdpau -vpx" CPU_FLAGS_X86="mmx" PYTHON_TARGETS="python2_7" 0 KiB


Thanks
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Sun Apr 19, 2015 8:43 pm    Post subject: Reply with quote

Apheus,

I added the two packages - media-libs/avidemux-core, media-libs/avidemux-plugins -
they do not installed by default during installing media-video/avidemux -
and followed your USE flags that you posted her - in particular USE flags of media-libs/avidemux-plugins -
and now I have SSA/ASS/SRT in subtitle filters :)
Now I am going to see how it embed subtitles...

Thanks
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Mon Apr 20, 2015 10:46 am    Post subject: Reply with quote

Now I see that after the process of avidemux ( I can see it with 'Preview', as well),
I get subtitle in gibberish - the .srt file is ok with my local language.
I tried to add some USE flags but still not ok.
Please advise how to add local fonts?
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
Apheus
Guru
Guru


Joined: 12 Jul 2008
Posts: 422

PostPosted: Mon Apr 20, 2015 11:49 am    Post subject: Reply with quote

I think the combination of use flags "libass" and "fontconfig" for media-video/ffmpeg was the needed bit for the filters to become visible. I'm surprised that there is no font selection in the filter's settings, I did not know that. Unfortunately, I do not know what font avidemux uses and if there is some indirect way to configure it...
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Mon Apr 20, 2015 6:34 pm    Post subject: Reply with quote

Apheus,

Quote:
I think the combination of use flags "libass" and "fontconfig" for media-video/ffmpeg
was the needed bit for the filters to become visible.

I am not sure about it - I added many USE flags, also to media-libs/avidemux-plugins, and I do not remember exactly...

It is really surprised to see that there is no fonts selection - it does not make sense and I guess there is some way to do it -
The main developer of Gentoo's avidemux called Tom Wijsman, and I used to see him response to topics in this Gentoo's forum,
but recently have not seen any post of him - hope he is around and will reply to this topic...

Thanks
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Mon Apr 20, 2015 8:41 pm    Post subject: Reply with quote

Maybe Jubler can help to fix the subtitle fonts for avidemux,
but I get this requirement and do not know if to accept or if it can cause any damage?
Code:
 Oracle requires you to download the needed files manually after
 * accepting their license through a javascript capable web browser.
 *
 * Download the following files:
 *   jdk-7u80-linux-x64.tar.gz
 * at 'http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html#jdk-7u80-oth-JPR'
 * and move them to '/usr/portage/distfiles'
 *
 * If the above mentioned urls do not point to the correct version anymore,
 * please download the files from Oracle's java download archive:
 *
 *    http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u80-oth-JPR

_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
Apheus
Guru
Guru


Joined: 12 Jul 2008
Posts: 422

PostPosted: Mon Apr 20, 2015 8:55 pm    Post subject: Reply with quote

It is in portage: =dev-java/oracle-jdk-bin-1.7.0.80. The license forbids mirroring by gentoo infrastucture, but you can download it from oracle, put it into /usr/portage/distfiles and then:

Code:
emerge dev-java/oracle-jdk-bin:1.7


But I don't see how a java program can help with the subtitle rendering in avidemux?
Back to top
View user's profile Send private message
pmam
Veteran
Veteran


Joined: 30 Dec 2013
Posts: 1145

PostPosted: Fri May 01, 2015 8:22 am    Post subject: Reply with quote

Jubler did not help so I returned to krinn tip and embedded the subtitle with the right font with mencoder like this command:
Code:
mencoder -o outfile infile -sub subfile -subcp cp1255 -font /usr/share/fonts/dejavu/DejaVuSans.ttf -oac mp3lame
-ovc xvid -lameopts cbr:br=128 -ovc xvid -xvidencopts pass=1

I get quite big output file but it works...

Anyway, I would prefer gui and hope someone knows how to add fonts to avidemux or with other gui application??
_________________
“You can take our property, our sweet homes, even our cloths...
But don't touch the streets, Ah, That's NO, NO, NO!
The streets are our @world's compilable kernel ...”
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 541
Location: Germany

PostPosted: Mon May 04, 2015 8:06 am    Post subject: Reply with quote

I've tried avidemux in the past, but it didn't work for me somehow. Now I'm using Handbrake and find it to be an interesting alternative. As far as I can see, it does support subtitles addition.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum