[FFmpeg-devel] {WIP} {HELP} Dvb Subtitles and Hard Subtitles

JULIAN GARDNER joolzg at btinternet.com
Thu Jun 9 01:57:45 CEST 2011





----- Original Message -----
> From: JULIAN GARDNER <joolzg at btinternet.com>
> To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
> Cc: 
> Sent: Wednesday, 8 June 2011, 8:29
> Subject: Re: [FFmpeg-devel] {WIP} {HELP} Dvb Subtitles and Hard Subtitles
> 
> 
> 
> 
>> ________________________________
>> From: Michael Niedermayer <michaelni at gmx.at>
>> To: FFmpeg development discussions and patches 
> <ffmpeg-devel at ffmpeg.org>
>> Sent: Wednesday, 8 June 2011, 5:15
>> Subject: Re: [FFmpeg-devel] {WIP} {HELP} Dvb Subtitles and Hard Subtitles
>> 
>> On Tue, Jun 07, 2011 at 11:56:44PM +0100, JULIAN GARDNER wrote:
>>> 
>>> 
>>> 
>>>  >________________________________
>>>  >From: JULIAN GARDNER <joolzg at btinternet.com>
>>>  >To: FFmpeg development discussions and patches 
> <ffmpeg-devel at ffmpeg.org>
>>>  >Sent: Tuesday, 7 June 2011, 14:00
>>>  >Subject: Re: [FFmpeg-devel] {WIP} {HELP} Dvb Subtitles and Hard 
> Subtitles
>>>  >
>>>  >
>>>  >
>>>  >
>>>  >
>>>  >----- Original Message -----
>>>  >> From: Michael Niedermayer <michaelni at gmx.at>
>>>  >> To: FFmpeg development discussions and patches 
> <ffmpeg-devel at ffmpeg.org>
>>>  >> Cc: 
>>>  >> Sent: Monday, 6 June 2011, 13:34
>>>  >> Subject: Re: [FFmpeg-devel] {WIP} {HELP} Dvb Subtitles and 
> Hard Subtitles
>>>  >> 
>>>  >> On Mon, Jun 06, 2011 at 11:15:32AM +0100, JULIAN GARDNER 
> wrote:
>>>  >>> 
>>>  >>> 
>>>  >>> 
>>>  >>>  >________________________________
>>>  >>>  >From: JULIAN GARDNER <joolzg at btinternet.com>
>>>  >>>  >To: FFmpeg development discussions and patches 
>>>  >> <ffmpeg-devel at ffmpeg.org>
>>>  >>>  >Sent: Sunday, 5 June 2011, 14:58
>>>  >>>  >Subject: [FFmpeg-devel] {WIP} {HELP} Dvb Subtitles 
> and Hard Subtitles
>>>  >>>  >
>>>  >>>  >Ok needing a bit of help here, ive added my current 
> diff in the hope of 
>>>  >> some help from a more knowledgable ffmpeg developer.
>>>  >>>  >
>>>  >>>  >My problem is that i need to get the main output loop 
> to eventually 
>>>  >> call the do_subtitle_out for every frame of video that is 
> produced.
>>>  >>>  >
>>>  >>>  >I have attempted to change the code where the 
> subtitle is decoded, only 
>>>  >> once in the case of dvbsubs, and to output it multiple times, 
> but the output bit 
>>>  >> is still only called once.
>>>  >>>  >
>>>  >>>  >Can anybody help me in getting the loop to make the 
> multiple calls to 
>>>  >> output the subtitles, im trying not to have to write this as a 
> filter, but to 
>>>  >> have the subs placed on the output video plane BEFORE resizing 
> and ENCODING?
>>>  >>>  >
>>>  >>>  >If you think im going about it the wrong way then let 
> me know, and if 
>>>  >> the only way is to produce a filter i will spend my time on 
> that instead.
>>>  >>>  >
>>>  >>>  >So just for clarity i need to get the subs to be 
> copied to the video 
>>>  >> before any resize or encoding is performed, if this works it 
> should be possible 
>>>  >> to take any subs and have them placed on the video.
>>>  >>>  >
>>>  >>>  >also one more problem is that the TS si still has the 
> entry for 
>>>  >> "dvb subs" in its pmt, this will need removing, as i 
> cant see the 
>>>  >> point of having hard subs and soft subs whch are the same.
>>>  >>>  >
>>>  >>>  >joolz
>>>  >>>  >
>>>  >>>  >_______________________________________________
>>>  >>>  >ffmpeg-devel mailing list
>>>  >>>  >ffmpeg-devel at ffmpeg.org
>>>  >>>  >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>  >>>  >
>>>  >>>  >
>>>  >>>  >
>>>  >>> 
>>>  >>>  Ok boys i have the "hards subs" kind of 
> working, but i need some 
>>>  >> help in dumping the subtitles onto the screen in the correct 
> format.
>>>  >>> 
>>>  >>>  I have modified ffmpeg.c and in the routine 
>>>  >> "pre_process_video_frame" i aim to do the dump of 
> the subs, im just 
>>>  >> testing but if i do a memset on the memory pointed at by 
>>>  >> picture->data[0]+x+y*picture->linesize[0] i get my boxes 
> in the correct 
>>>  >> place.
>>>  >>> 
>>>  >>>  What i need to do now is translate the subtitles pixel 
> and clut map into 
>>>  >> the correct format and add this to the plane, now the good 
> point of this is that 
>>>  >> scaling the video works after this.
>>>  >>> 
>>>  >>>  Any help please.
>>>  >> 
>>>  >> for format convert see swscale (maybe libavfilter/vf_scale.c 
> is a
>>>  >> useable example on its useage)
>>>  >> 
>>>  >> for blend/overlay of stuff see vf_overlay.c
>>>  >>     
>>>  >>     
>>>  >> [...]
>>>  >> 
>>>  >> -- 
>>>  >> Michael     GnuPG fingerprint: 
> 9FF2128B147EF6730BADF133611EC787040B0FAB
>>>  >> 
>>>  >> The real ebay dictionary, page 2
>>>  >> "100% positive feedback" - "All either got 
> their money back or 
>>>  >> didnt complain"
>>>  >> "Best seller ever, very honest" - "Seller 
> refunded buyer after 
>>>  >> failed scam"
>>>  >> 
>>>  >> _______________________________________________
>>>  >> ffmpeg-devel mailing list
>>>  >> ffmpeg-devel at ffmpeg.org
>>>  >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>  >>
>>>  >
>>>  >OK "Hard Subtitles" working now, test phase to continue 
> but i have a few queries regarding what should be done with certain cases
>>>  >
>>>  >1. dvd-subtitle-problem.vob
>>>  >  This file has a video size of 352x288 but the dvbsubs are being 
> displayed out of this range so my options are
>>>  >    a) Dont render out of visible screen area (current system)
>>>  >    b) Swscale the video to fix the subtitle expected screen size, 
> draw subs, recscale back to original size (lots of cpu)
>>>  >    c) Rescale the subtitles themselves and also the position and 
> then draw on screen (need a new rescaler)
>>>  >
>>>  >2. As i see it .SRT and .SUB decode the subs but dont render them, 
> what would be good would be for all the subtitle engines to render to a bitmap 
> buffer, with clut and regions. If this is the case then we could do things like 
> Hard Subs, Ass->Dvb, Srt-Dvb etc Is this a feasable way forward?
>>>  >
>>>  >3. Xsub seems to work now except for the demo i have being a 
> 720x408 screen and the subtitles are positioned at 174,464, so back to 1
>>>  >
>>>  >I need to do more testing but the problem streams i started with 
> all work well and the subtitles appear where and in the correct colours as they 
> should.
>>>  >
>>>  >I have some encoded files i will put up on my ftp if anyone want to 
> see some examples or the hard subs
>>>  >
>>>  >
>>>  >joolz
>>>  >_______________________________________________
>>>  >ffmpeg-devel mailing list
>>>  >ffmpeg-devel at ffmpeg.org
>>>  >http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>> 
>>> 
>>>  OK boys i have another small problem, which im having trouble finding 
> the cause of?
>>> 
>>> 
>> 
>>>  When i put "hard subtitles" on the screen i get nice 
> subtitles, but i also get atrifacts around the subtitles which move around the 
> subtitle.
>> 
>> sounds like you write into the reference frames.
>> theres no alternative than making a copy
>> 
>> [...]
>> -- 
>> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>> 
>> While the State exists there can be no freedom; when there is freedom there
>> will be no State. -- Vladimir Lenin
>> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> 
> Thanks for that, will modify the code and test again.
> 
> Now another question. This test is being done on LIVE streams.
> 
> Iissue the ffmpeg line without the "-scodec" line everything works as 
> it should.
> 
> Issue with the "-scodec dvbsub" AND THERE ARE dvbsubs in the stream 
> again we work, not perfectly.
> 
> Issue with the "-scodec dvbsub" AND THERE ARE NO SUBS BEING 
> TRANSMITTED, but the si contains the correct si saying they are there we get a 
> problem.
> 
> What seems to be happening is that the new encoded data is being buffered and is 
> waiting for the dvbsub title stream to pass data into the stream, what i see is 
> the status line does not change so we get "time=00:00:00.00 
> bitrate=0.0kbits/s" and after a while ffmpeg just drops out without an 
> error
> 
> joolz
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Thanks Michael for the pointer, fixed the flashing subtitles. So now for some more testing.

Now all i need to get working is the problem i mentioned with regards to
 ffmpeg not liking the fact that dvbsubs are mentioned in the command 
line, that they are mentioned in the streams but no data is coming in for 
them.

Anybody have any ideas as to why the time and bitrate stop working, and eventually ffmpeg just drops out with no error messages?

joolz


More information about the ffmpeg-devel mailing list