[FFmpeg-devel] Maintainer responsibilities

2017-01-04 Thread Nicholas Robbins
Hello,

I am the maintainer of the dejudder filter. I haven't done anything to it since 
it contributed it almost two years ago. I follow this list, never seeing 
anything specifically mentioning it. Is there something else I should be doing 
as the maintainer?

-Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Past Duration too large

2015-11-05 Thread Nicholas Robbins
It seems like this is more an ffmpeg-user question. I asked there and got no 
responses.

During some of my encodes, I get quite a lot of these warnings.

What do they mean?

For example: here is a chuck of the output I am talking about

Past duration 0.998009 too large=  718546kB time=01:33:23.23 
bitrate=1050.5kbits/s dup=0 drop=7
Past duration 0.994011 too large
Past duration 0.990013 too large
Past duration 0.92 too large
Past duration 0.995995 too large
Past duration 0.991997 too large
Past duration 0.987999 too large
Past duration 0.998009 too large
Past duration 0.994011 too large
Past duration 0.990013 too large=  718665kB time=01:33:24.54 
bitrate=1050.5kbits/s dup=0 drop=7

that repeats pretty much constantly. In a 1h48m encode, it happens 42417 times.

What is this telling me?

The command is:

/usr/bin/ffmpeg -hide_banner -benchmark -i laptop.film.mkv -map 0 -c:a copy 
-c:s copy -c:v libx264
-preset veryfast -crf 17 -r 24000/1001 laptop.mkv


the input file is a mkv with ntsc-film material claiming to be ntsc rate. 
(23.97 framerate per the frames, but container thinks it is 29.97 fps)


I can provide the uncut output if that is helpful.

-Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add setfps filter

2015-10-15 Thread Nicholas Robbins
> On Thursday, October 15, 2015 7:18 AM, Paul B Mahol  wrote:

> > On 10/15/15, Nicolas George  wrote:
>>  Le quartidi 24 vendemiaire, an CCXXIV, Paul B Mahol a ecrit :
>>>  IMHO, it is far easier to use this filter than some complicated setpts
>>>  expression.
>> 
>>  True, but shortcuts in the setpts filter would be a better solution for
>>  that: having a bunch of filters that do slightly different things with the
>>  PTS is very bad for users because they have a hard time figuring which one
>>  is suited for their needs.
>> 
>>  (Also, the thing that this setfps filter does is evil, so it should not be
>>  encouraged.)
> 

> It should duplicate assumefps from avs/vs.

How is -vf setfps=24000/1001 different from putting -r 24000/1001 on the input 
file?

-Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add setfps filter

2015-10-02 Thread Nicholas Robbins
On Friday, October 2, 2015 2:00 PM, Moritz Barsnick  wrote:
>
>
>On Fri, Oct 02, 2015 at 19:47:12 +0200, Paul B Mahol wrote:
>> fps filter duplicated or removes frames to produce cfr output.
>> This filter changes fps and do not remove or duplicate single
>> frame so output becomes faster or slower when played when
>> fps increase or decrease.
>
>Ah! So, in other words, it takes input frames, totally disregads their
>pts/dts, and puts each one into a cfr output stream at the given fps?
>
>That solves a lot of problems and ridiculous math. :-) I will try it.
>
>Cheers,
>
>Moritz



Can't this be accomplished by the setpts filter?


Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]doc: Improve fieldmatch documentation

2015-09-03 Thread Nicholas Robbins



> On Wednesday, September 2, 2015 5:43 PM, Carl Eugen Hoyos  
> wrote:

> I didn't test because it works fine afaict.


Great

>>  Or are you offering a suggestion for mixed 24fps 
>>  progressive and 24->30 telecined?
> 
> Yes.
> 
>>  In that case it seems like this should work. 
> 
> This is what my tests showed.
> (But I don't have a long sample.)
> 
>>  You are using dejudder & fps to produce a stream of 
>>  frames lies ABCDDEFGHH... then decimate drops the 
>>  dups. Seems brutal. 
> 
> Why / how?


It just seems strange to me to make those extra frames just to throw them away. 
Seems mean to the frames I guess. But, if it works..

>>  Is there a reason why this filter chain is preferable >>  to 
>> pullup,dejudder? (perhaps with fps) or is this 
>>  just another option?
> 
> pullup is a faster alternative that may not produce 
> perfect output, I don't think it works (or can be used) 
> with the fps filter (that I consider being broken or at 
> least showing unexpected behaviour.

> > Carl Eugen



Ok, good to know. Glad to see anyone besides me is using dejudder.


-Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]doc: Improve fieldmatch documentation

2015-09-03 Thread Nicholas Robbins
> On Thursday, September 3, 2015 8:45 AM, Carl Eugen Hoyos <ceho...@ag.or.at> 
> wrote:

> > Nicholas Robbins  ffmpeg.org> writes:
> 
>>  >>  You are using dejudder & fps to produce a stream of 
>>  >>  frames lies ABCDDEFGHH... then decimate drops the 
>>  >>  dups. Seems brutal. 
>>  > 
>>  > Why / how?
>> 
>>  It just seems strange to me to make those extra frames 
>>  just to throw them away. Seems mean to the frames I
>>  guess. But, if it works..
> 


I meant in the 24fps progressive original.  There you start with

A/A B/B C/C D/D

fps=30 turns it into

A/A B/B C/C D/D D/D

which decimate turns back into 


A/A B/B C/C D/D


No harm. Just seems like a strange work-around.


Your revised documentation is clear to me.

-Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]doc: Improve fieldmatch documentation

2015-09-02 Thread Nicholas Robbins
On Wednesday, September 2, 2015 7:50 AM, Carl Eugen Hoyos  
wrote:
>Hi!
>
>As Clément always pointed out correctly, the issues users see with 
>fieldmatch and mixed telecined and progressive content have nothing 
>to do with decimate (and of course not fieldmatch) but with the 
>specifics of our fps filter (see my ignored mail for details).
>
>Attached patch should help, please comment.
>
>Carl Eugen


As the author of dejudder it does not produce exactly evenly paced frames. It 
basically does a rolling average of the last n (default of 4 for pullup  30->24 
fps) frames for the PTS of the next frame.

If the judder is just noise, and you are using it as denoiser on the PTS's of 
the input frames, it should work for that. However, it would work better with a 
larger n. If the PTS's are just randomly noised, then the standard deviation 
should scale as 1/n. 

If the judder is periodic, then you want to fit your n to that judder, if you 
don't know just pick a large n. The default n is 4 which is for the judder of 
dropping every fifth frame (as pullup does on telecined 23 material) 

Do you have a sample where dejudder used like this helps? If so does it work 
better with larger n?

Your suggestion is for material that is a mix of 30 fps progressive and 24->30 
telecined? I don't know that you would want to decimate that. It will produce 
judder from the dropped frames. That might be a usecase for the new framerate 
filter.

Or are you offering a suggestion for mixed 24fps progressive and 24->30 
telecined? In that case it seems like this should work.  You are using dejudder 
& fps to produce a stream of frames lies ABCDDEFGHH... then decimate drops the 
dups. Seems brutal. Is there a reason why this filter chain is preferable to 
pullup,dejudder? (perhaps with fps) or is this just another option? 

Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]Mention in the documentation that fieldmatch needs cfr input

2014-10-29 Thread Nicholas Robbins
 On Wednesday, October 29, 2014 12:25 PM, Carl Eugen Hoyos ceho...@ag.or.at 
 wrote:

  Calvin Walton calvin.walton at kepstin.ca writes:
 
  For content that was in mpeg2 with field flags set 
  appropriate for display on an interlaced TV 
 
 This is unrelated to this issue:
 FFmpeg simply ignores the flag and interprets the 
 input as progressive.
 
  which basically accounts for all DVD content
 
 I live in PAL-country but from user reports and 
 samples (like the one in question) I know that 
 this unfortunately isn't true;-(
 
 This whole issue is about vob files that contain 
 both progressive 24000/1001 and (hard-) telecined 
 3/1001 video in the same stream (with actual 
 switching frame rates).
 It appears to me that decimate should detect the 
 frame rate changes and not drop anything for the 
 progressive content.
 
 Carl Eugen


I've also seen mixed hard telecined (24-29.97) and interlaced (29.97) in the 
same stream, or hard telecined and 29.97 progressive. This whole thing makes me 
wish we used PAL here. Also metric paper, but that is a different gripe.

Not now, but later, I would be interested in helping to adapt decimate to do 
what we want.
A detectfps filter might be useful too, and would be a subset of the work.

Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Fw: [FFmpeg-user] How to create trapezoid videos with ffmpeg?

2014-10-17 Thread Nicholas Robbins
 On Thursday, October 16, 2014 11:59 AM, Moritz Barsnick barsn...@gmx.net 
 wrote:


  Hi Zenny,
 
 On Wed, Oct 15, 2014 at 10:55:40 +0200, Zenny wrote:
  New to ffmpeg. How can one create a trapezoid shaped video as a
  overlay to the background as seen at
  http://www.youtube.com/watch?v=_380o5B9MrA (starts at 00:02:25) using
  ffmpeg command?
 
 I can't seem to find a filter which does that directly, but the
 perspective does a similar transformation, in an inverse way. I
 believe it virtually pulls the given viewpoints to the corners. 
 Using
 it with values pointing at viewpoints outside of the frame gives the
 approximate effect of what you're trying to achieve, see my example
 below. Interestingly, that filter smears the edges colors of the input
 across the rest of the output frame. (I'm not sure whether that's a bug
 or a feature.)
 
 Here's an example, using a test source with an overlayed outline and
 grid lines, to may the effect more clearly visible. It uses the SDL
 display driver as output to screen, but you can output to a file
 alternatively:
 
 ffmpeg -re -f lavfi -i 
 testsrc,drawbox=x=1:y=1:w=iw-2:h=ih-2:t=1:c=white,drawgrid=w=iw/10:h=ih/10:t=1:c=white@0.5
  
 -filter_complex [0:v]perspective=x0=-100:y0=-100:x2=-100:y2=H+100[ovl1]; 
 [0:v]pad=w=iw*2[ovl0]; [ovl0][ovl1]overlay=x=W/2[vidout] -map 
 [vidout] -pix_fmt yuv420p -f sdl -
 
 I use the -filter_complex chain to combine the original and the
 transformed output side-by-side. The relevant perspective filter
 section is:
 
 perspective=x0=-100:y0=-100:x2=-100:y2=H+100
 
 Note the reference points _outside_ of the frame to achieve a trapezoid
 size reduction. The filter you are looking for should probably accept
 actual corner values. That said, such a filter could probably be
 derived from the perspective filter's code. (I failed at finding 
 an
 easy way to do this though.)
 
 Moritz


Ok, it seems like this should be easier. If we had a filter that did the same 
thing as vf_perspective but with inverse options this would be easy. So instead 
telling it what points you want to send to the corners, you tell it where you 
want the corners sent. 

I ran the math and the formulas to map between the two different ways of 
specifying the projective transformation are a bit messy. For instance, if you 
want to send the corners to  x0:y0:x1:y1:x2:y2:x3:y3 the first option for the 
vf_perspective should be 

(W (x2 y0 - x0 y2) (x3 (y0 - y1) + x0 (y1 - y3) +
x1 (-y0 + y3)) (x3 (y1 - y2) + x1 (y2 - y3) +
x2 (-y1 + y3)))/(-x0 (x3^2 (y1 - y2) (-2 y1 y2 + y0 (y1 + y2)) -
  2 x2 x3 y1 (y1 - y2) (y0 - y3) + x2^2 y0 (y1 - y3)^2) +
  x2 x3 (y0 - y1)^2 (-x3 y2 + x2 y3) +
  x1 (x3^2 y1 (y0 - y2)^2 + 2 x0 x3 (y1 - y2) y2 (y0 - y3) -
  x0^2 y1 (y2 - y3)^2 - 2 x2 (y1 - y2) (y0 - y3) (x3 y0 + x0 y3) +
  x2^2 (y0 - y3) (y0 (y1 - 2 y3) + y1 y3)) +
  x0^2 (x2 y2 (y1 - y3)^2 - x3 (y1 - y2) (2 y1 y2 - y1 y3 - y2 y3)) +
x1^2 (x0 y0 (y2 - y3)^2 - x3 (y0 - y2)^2 y3 -
  x2 (y0 - y3) (y0 (y2 - 2 y3) + y2 y3)))

not something you can put on the command line or even want to work out by hand. 
However, it would be totally doable to calculate in filter initialization. 

So is it possible to make a filter that is basically just a wrapper around 
another filter? This hypothetical filter (call it vf_keystone) would just call 
vf_perspective with crazy options. Clearly I could just copy the vf_perspective 
filter and then insert these changes, but than any future changes to 
vf_perspective wouldn't filter down to vf_keystone.

Is this possible?

-Nick

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [FFmpeg-user] How to create trapezoid videos with ffmpeg?

2014-10-17 Thread Nicholas Robbins
 On Friday, October 17, 2014 2:30 PM, Nicholas Robbins nickrobb...@yahoo.com 
 wrote:


snip actual request

 Ok, it seems like this should be easier. If we had a filter that did the same 
 thing as vf_perspective but with inverse options this would be easy. So 
 instead 
 telling it what points you want to send to the corners, you tell it where you 
 want the corners sent. 
 
 I ran the math and the formulas to map between the two different ways of 
 specifying the projective transformation are a bit messy. For instance, if 
 you 
 want to send the corners to  x0:y0:x1:y1:x2:y2:x3:y3 the first option for the 
 vf_perspective should be 
 
snip messy formula

 not something you can put on the command line or even want to work out by 
 hand. 
 However, it would be totally doable to calculate in filter initialization. 
 
 So is it possible to make a filter that is basically just a wrapper around 
 another filter? This hypothetical filter (call it vf_keystone) would just 
 call 
 vf_perspective with crazy options. Clearly I could just copy the 
 vf_perspective 
 filter and then insert these changes, but than any future changes to 
 vf_perspective wouldn't filter down to vf_keystone.
 
 Is this possible?

 -Nick

Upon further thought and a closer read of the vf_perspective code, I think an 
easier option would be to insert an option of sense or mode or something. 
Then condition the code at lines 144-160 (these lines calculate the matrix used 
for the transformation) and then put in another block conditioned on the mode 
that finds the inverse matrix rather than the matrix currently found.

Is this a reasonable approach? If so, I think I'll put this in in a little 
while.

-Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] libavcodec/dvdsubdec: Add option forced_subs_only to only decode forced subtitle frames.

2014-09-22 Thread Nicholas Robbins
ping



On Saturday, September 20, 2014 7:54 AM, Nicholas Robbins 
nickrobbins-at-yahoo@ffmpeg.org wrote:
 



Signed-off-by: Nicholas Robbins nickrobb...@yahoo.com
---
libavcodec/dvdsubdec.c | 5 +
1 file changed, 5 insertions(+)

diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index c7973f0..bb28d9e 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -39,6 +39,7 @@ typedef struct DVDSubContext
   uint8_t  alpha[256];
   uint8_t *buf;
   int  buf_size;
+  int  forced_subs_only;
#ifdef DEBUG
   int sub_id;
#endif
@@ -548,6 +549,9 @@ static int dvdsub_decode(AVCodecContext *avctx,
 if (!is_menu  find_smallest_bounding_rectangle(sub) == 0)
 goto no_subtitle;

+if (ctx-forced_subs_only  !(sub-rects[0]-flags  
AV_SUBTITLE_FLAG_FORCED))
+goto no_subtitle;
+
#if defined(DEBUG)
 {
 char ppm_name[32];
@@ -652,6 +656,7 @@ static av_cold int dvdsub_close(AVCodecContext *avctx)
#define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
 { palette, set the global palette, OFFSET(palette_str), 
 AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD },
+{ forced_subs_only, Only show forced subtitles, 
OFFSET(forced_subs_only), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, SD},
 { NULL }
};
static const AVClass dvdsub_class = {
-- 
1.8.5.5


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] doc/decoders: adding documentation for lavc/dvdsubdec.c option forced_subs_only

2014-09-22 Thread Nicholas Robbins
Signed-off-by: Nicholas Robbins nickrobb...@yahoo.com
---
 doc/decoders.texi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/doc/decoders.texi b/doc/decoders.texi
index 6910dc1..56ce928 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -190,6 +190,11 @@ The format for this option is a string containing 16 
24-bits hexadecimal
 numbers (without 0x prefix) separated by comas, for example @code{0d00ee,
 ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1,
 7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b}.
+
+@item forced_subs_only
+Only decoded subtitle entries marked as forced. Some titles have forced
+and non-forced subtitles in the same track. Setting this flag to @code{1}
+will only keep the forced subtitles. Default value is @code{0}.
 @end table
 
 @section libzvbi-teletext
-- 
1.8.5.5

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] doc/decoders: adding documentation for lavc/dvdsubdec.c option forced_subs_only

2014-09-22 Thread Nicholas Robbins
 On Monday, September 22, 2014 3:28 PM, Nicholas Robbins 
 nickrobbins-at-yahoo@ffmpeg.org wrote:

 +Only decoded subtitle entries marked as forced. Some titles have forced

Should be 'decode' not 'decoded'. Resent patch

-Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavcodec/dvdsubdec: Add option forced_subs_only to only decode forced subtitle frames.

2014-09-20 Thread Nicholas Robbins
Signed-off-by: Nicholas Robbins nickrobb...@yahoo.com
---
 libavcodec/dvdsubdec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index c7973f0..bb28d9e 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -39,6 +39,7 @@ typedef struct DVDSubContext
   uint8_t  alpha[256];
   uint8_t *buf;
   int  buf_size;
+  int  forced_subs_only;
 #ifdef DEBUG
   int sub_id;
 #endif
@@ -548,6 +549,9 @@ static int dvdsub_decode(AVCodecContext *avctx,
 if (!is_menu  find_smallest_bounding_rectangle(sub) == 0)
 goto no_subtitle;
 
+if (ctx-forced_subs_only  !(sub-rects[0]-flags  
AV_SUBTITLE_FLAG_FORCED))
+goto no_subtitle;
+
 #if defined(DEBUG)
 {
 char ppm_name[32];
@@ -652,6 +656,7 @@ static av_cold int dvdsub_close(AVCodecContext *avctx)
 #define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
 static const AVOption options[] = {
 { palette, set the global palette, OFFSET(palette_str), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, SD },
+{ forced_subs_only, Only show forced subtitles, 
OFFSET(forced_subs_only), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, SD},
 { NULL }
 };
 static const AVClass dvdsub_class = {
-- 
1.8.5.5

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] Only decode forced subtitles frames.

2014-09-20 Thread Nicholas Robbins
---
 libavcodec/dvdsubdec.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 7355c03..de1ecbf 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -39,6 +39,7 @@ typedef struct DVDSubContext
   uint8_t  alpha[256];
   uint8_t *buf;
   int  buf_size;
+  int  forced_subs_only;
 #ifdef DEBUG
   int sub_id;
 #endif
@@ -548,6 +549,9 @@ static int dvdsub_decode(AVCodecContext *avctx,
 if (!is_menu  find_smallest_bounding_rectangle(sub) == 0)
 goto no_subtitle;
 
+if (ctx-forced_subs_only  !(sub-rects[0]-flags  
AV_SUBTITLE_FLAG_FORCED))
+goto no_subtitle;
+
 #if defined(DEBUG)
 {
 char ppm_name[32];
@@ -652,6 +656,7 @@ static av_cold int dvdsub_close(AVCodecContext *avctx)
 #define VD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
 static const AVOption options[] = {
 { palette, set the global palette, OFFSET(palette_str), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VD },
+{ forced_subs_only, Only show forced subtitles, 
OFFSET(forced_subs_only), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, VD},
 { NULL }
 };
 static const AVClass dvdsub_class = {
-- 
1.8.5.5

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [patch] Only decode forced dvd-subtitles

2014-09-19 Thread Nicholas Robbins
Ok, not to beat a dead horse, but I think I've gotten this working. I think it 
might work better in lavc/dvdsubdec.c. AFAICT this works and doesn't produce 
mangled tracks. Patch at end of email. (Sorry for the inline patch) If this is 
a good patch, I'll add the appropriate documentation and do a proper 
commit-patch 



diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 7355c03..874c28b 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -39,6 +39,7 @@ typedef struct DVDSubContext
   uint8_t  alpha[256];
   uint8_t *buf;
   int  buf_size;
+  int  only_dec_forced;
#ifdef DEBUG
   int sub_id;
#endif
@@ -548,6 +549,9 @@ static int dvdsub_decode(AVCodecContext *avctx,
 if (!is_menu  find_smallest_bounding_rectangle(sub) == 0)
 goto no_subtitle;

+if (ctx-only_dec_forced  !(sub-rects[0]-flags  
AV_SUBTITLE_FLAG_FORCED))
+goto no_subtitle; 
+
#if defined(DEBUG)
 {
 char ppm_name[32];
@@ -652,6 +656,7 @@ static av_cold int dvdsub_close(AVCodecContext *avctx)
#define VD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
 { palette, set the global palette, OFFSET(palette_str), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VD },
+{ only_dec_forced, Only decode forced subtitles, 
OFFSET(only_dec_forced), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, VD},
 { NULL }
};
static const AVClass dvdsub_class = {

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [patch] Only decode forced dvd-subtitles

2014-09-19 Thread Nicholas Robbins
 On Friday, September 19, 2014 12:31 PM, Carl Eugen Hoyos ceho...@ag.or.at 
 wrote:




  Nicholas Robbins nickrobbins-at-yahoo.com at ffmpeg.org writes:
 
  +{ only_dec_forced, Only decode forced 
 subtitles,
 
 Please use the same option name as for pgs subtitles.
 
 Carl Eugen


Ok, I'll do that. Also I noticed that dvdsubdec.c says:

#define VD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
{ palette, set the global palette, OFFSET(palette_str), 
AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VD }

While pgssubdec.c says:

#define SD AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
{forced_subs_only, Only show forced subtitles, 
OFFSET(forced_subs_only), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, SD},

Shouldn't dvdsubdec have SD rather than VD for readability at least?

Also, this requires the option be set by -forced_subs_only 1. How does one 
implement boolean options so I could set it by -forced_subs_only?

-Nick

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [patch] Only decode forced dvd-subtitles

2014-09-19 Thread Nicholas Robbins
 On Friday, September 19, 2014 1:15 PM, wm4 nfx...@googlemail.com wrote:

 
 Sorry, but didn't the discussion go towards that ffmpeg.c should filter
 out subtitles flagged as forced?
 
 And in fact, the PGS decoder should be changed to flag forced subs
 correctly.




I've never peeked inside ffmpeg.c so I don't know if I can figure out how to 
remove the unforced subs there, but if that is the only way to get this patch 
in, I'll see if I can figure it out. 

-N

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Status of dvdsub forced_subs_only patch

2014-09-16 Thread Nicholas Robbins
Ok, I seem to have a partial solution.

I thought that the place to put this would be in the dvdsubenc.c. So I made the 
following changes (sorry for inline patch)


diff --git a/libavcodec/dvdsubenc.c b/libavcodec/dvdsubenc.c
index 425f0af..7cae3f4 100644
--- a/libavcodec/dvdsubenc.c
+++ b/libavcodec/dvdsubenc.c
@@ -30,6 +30,7 @@ typedef struct {
 AVClass *class;
 uint32_t global_palette[16];
 int even_rows_fix;
+int only_enc_forced;
} DVDSubtitleContext;

// ncnt is the nibble counter
@@ -277,6 +278,9 @@ static int encode_dvd_subtitles(AVCodecContext *avctx,
 forced = 1;
 break;
 }
+if (!forced  dvdc-only_enc_forced)
+   return 0; 
+
 vrect = *h-rects[0];

 if (rects  1) {
@@ -453,6 +457,7 @@ static int dvdsub_encode(AVCodecContext *avctx,
#define SE AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static const AVOption options[] = {
 {even_rows_fix, Make number of rows even (workaround for some 
players), OFFSET(even_rows_fix), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, SE},
+{only_enc_forced, Only encode forced subtitles, 
OFFSET(only_enc_forced), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, SE},
 { NULL },
};

Ok, with this change, ffmpeg compiles fine. To do my testing, I have a file 
called subs.mkv that just has two subtitle tracks. Both tracks have about 1000 
subtitles. Track 0 has 46 forced subtitles, and track 1 has zero. 



The commands I am using are 

ffmpeg -i subs.mkv -map 0 -c:s dvdsub -only_enc_forced 1 only.mkv

This produces a smaller file. (from 7.9M to 240K)

If I pull out the subs  idx's using  

mkvextract tracks rec.mkv 0:subs-0.sub 1:subs-1.sub produces strange results. 
The idx's are the same size (49K  61K) as the original idx's, but the .sub 
files are smaller (2.3M  2.8M from 4.9M and 5.5M)

However, something isn't right. If I try to open these new sub/idx's in 
BDsup2sub I get: ERROR: Invalid control buffer size

However, if I put the only.mkv through ffmpeg again with:

ffmpeg -i only.mkv -map 0 -c:s dvdsub recode.mkv

And then pull the mkv's out with similar mkvextract command, it get the 46 (in 
0) and 0 (in 1) subtitles I was expecting.

The file sizes are also saner (idx's 2.2K  219B, .subs 184K and 0B)

So, it seems like what I am doing produces a mangled dvdsub track, but one that 
ffmpeg can make sense of. It isn't just some muxing thing since if I run 
only.mkv through mkvmerge, it doesn't get fixed.

How can I finish this patch?

-Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] Status of dvdsub forced_subs_only patch

2014-09-15 Thread Nicholas Robbins
Oliver Fromme wrote:

 Michael Niedermayer wrote:
  On Sun, Jun 29, 2014 at 05:36:32PM +0200, Oliver Fromme wrote:
   [...]
   The problem with dropping rectangles in utils.c is that there
   might be multiple output streams.  The flag (forced subtitles
   only) might be set for some output streams, but not for others.
   So, if we dropped some rectangles from the AVSubtitle structure
   in utils.c, they will be missing from other output streams that
   are encoded afterwards.
  
  You can put the, to be kept rectangles in a new AVSubtitle struct.

 Oh, it didn't occur to me to generate an new AVSubtitle struct
 in utils.c.  Thanks for pointing that out.
 
 I'll give that a try and make a new patch.
 
 Best regards
   Oliver

Has there been any update on this?

I would like to be able to pick out only the forced subtitles from a dvdsub 
track. This looks like it was my best bet. I can't find any documentation of 
this or figure out a useful place to put -forced_subs_only 1 in the command 
line:

ffmpeg -forced_subs_only 1 -i tmp.mkv  -map 0 -c:s dvdsub   out.mkv

I get ...

Codec AVOption forced_subs_only (Only show forced subtitles) specified for 
input file #0 (tmp.mkv) has not been used for any stream. The most likely 
reason is either wrong type (e.g. a video option with no video streams) or that 
it is a private option of some decoder which was not actually used for any 
stream.

tmp.mkv is just:

Stream #0:0(eng): Subtitle: dvd_subtitle, 720x480 (default)
Metadata:
  LANGUAGE: eng
  ENCODER : Lavc55.69.100 dvdsub


-Nick
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel