Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality!
@ 2022-05-03 16:13 Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 01/12] Implemented text to bitmap subtitles! Traian Coza
                   ` (13 more replies)
  0 siblings, 14 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

I added the possibility of converting text-based subtitle tracks (such as subrip or ass) to bitmap-based subtitle tracks (such as dvd_subtitle).

I accomplished this by using libass, and basically using the code from vf_subtitles.c to render text subtitles and store the images in the AVSubtitle structure.

Of course, this functionality will only work when ffmpeg is configured with --enable-libass.

Traian Coza (12):
  Implemented text to bitmap subtitles!
  Render only when necessary
  Retreive width and height from video stream!
  Initialize ass library only once!
  Cleaned up
  Wrote proper headers
  Close libass after using
  Added standard headers
  Rearranged files, all tests are passing!
  Rearranged files, all tests are passing!
  Added logging
  Added more logging

 fftools/Makefile         |   2 +
 fftools/ffmpeg.c         |  35 ++++-
 fftools/text_to_bitmap.c | 300 +++++++++++++++++++++++++++++++++++++++
 fftools/text_to_bitmap.h |  37 +++++
 libavcodec/avcodec.h     |   9 ++
 5 files changed, 382 insertions(+), 1 deletion(-)
 create mode 100644 fftools/text_to_bitmap.c
 create mode 100644 fftools/text_to_bitmap.h

-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 01/12] Implemented text to bitmap subtitles!
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 02/12] Render only when necessary Traian Coza
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 fftools/ffmpeg.c           |  47 ++++++++++++++-
 libavfilter/vf_subtitles.c | 117 +++++++++++++++++++++++++++++++++++++
 2 files changed, 163 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index a85ed18b08..53717d3ebb 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2325,6 +2325,45 @@ fail:
     return err < 0 ? err : ret;
 }
 
+void render_avsub_ass(InputStream *, AVSubtitle *);
+
+static void print_subtitle(AVSubtitle sub)
+{
+    printf("sub.format: %u\n", sub.format);
+    printf("sub.start_display_time: %u\n", sub.start_display_time);
+    printf("sub.end_display_time: %u\n", sub.end_display_time);
+    printf("sub.num_rects: %u\n", sub.num_rects);
+    printf("sub.pts: %ld\n", sub.pts);
+    for (int i = 0; i < sub.num_rects; i++)
+    {
+        printf("sub.rects[%d]->type: %d\n", i, sub.rects[i]->type);
+        printf("sub.rects[%d]->nb_colors: %d\n", i, sub.rects[i]->nb_colors);
+        printf("sub.rects[%d]->(x,y,w,h): (%d,%d,%d,%d)\n", i, sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h);
+        printf("sub.rects[%d]->linesize: [%d,%d,%d,%d]\n", i, sub.rects[i]->linesize[0], sub.rects[i]->linesize[1], sub.rects[i]->linesize[1], sub.rects[i]->linesize[1]);
+        switch (sub.rects[i]->type)
+        {
+            case SUBTITLE_TEXT:
+                printf("sub.rects[%d]->text: %s\n", i, sub.rects[i]->text);
+                break;
+            case SUBTITLE_ASS:
+                printf("sub.rects[%d]->ass: %s\n", i, sub.rects[i]->ass);
+                break;
+            case SUBTITLE_BITMAP:
+                for (int c = 0; c < sub.rects[i]->nb_colors; c++)
+                    printf("color %d: [%u,%u,%u,%u]\n", c,
+                           sub.rects[i]->data[1][c * 4 + 0],
+                           sub.rects[i]->data[1][c * 4 + 1],
+                           sub.rects[i]->data[1][c * 4 + 2],
+                           sub.rects[i]->data[1][c * 4 + 3]);
+                for (int y = 0; y < sub.rects[i]->h; y++, printf("\n"))
+                    for (int x = 0; x < sub.rects[i]->w; x++)
+                        printf("%d", sub.rects[i]->data[0][y * sub.rects[i]->w + x]);
+                break;
+        }
+    }
+    printf("\n");
+}
+
 static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
                                int *decode_failed)
 {
@@ -2383,6 +2422,8 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
         goto out;
 
     ist->frames_decoded++;
+    
+    render_avsub_ass(ist, &subtitle);
 
     for (i = 0; i < nb_output_streams; i++) {
         OutputStream *ost = output_streams[i];
@@ -3213,11 +3254,15 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame,
                 input_props = input_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
             if (output_descriptor)
                 output_props = output_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
-            if (input_props && output_props && input_props != output_props) {
+            /*if (input_props && output_props && input_props != output_props) {
                 snprintf(error, error_len,
                          "Subtitle encoding currently only possible from text to text "
                          "or bitmap to bitmap");
                 return AVERROR_INVALIDDATA;
+            }*/
+            if (input_props == AV_CODEC_PROP_BITMAP_SUB && output_props == AV_CODEC_PROP_TEXT_SUB) {
+                snprintf(error, error_len, "Subtitle encoding from bitmap to text currently not possible");
+                return AVERROR_INVALIDDATA;
             }
         }
 
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index 82e140e986..f751786033 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -181,6 +181,24 @@ static void overlay_ass_image(AssContext *ass, AVFrame *picref,
     }
 }
 
+static void print_ass_image(const ASS_Image *image)
+{
+    int index = 0;
+    for (; image != NULL; image = image->next, index++)
+    {
+        printf("index: %d\n", index);
+        printf("image->(dst_x,dst_y): (%d,%d)\n", image->dst_x, image->dst_y);
+        printf("image->(w,h): (%d,%d)\n", image->w, image->h);
+        printf("image->stride: %d\n", image->stride);
+        printf("image->type: %d\n", image->type);
+        printf("image->color: [%u,%u,%u,%u]\n", AR(image->color), AG(image->color), AB(image->color), AA(image->color));
+        for (int y = 0; y < image->h; y++, printf("\n"))
+            for (int x = 0; x < image->w; x++)
+                printf("%02X", image->bitmap[y * image->stride + x]);
+        printf("\n");
+    }
+}
+
 static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
 {
     AVFilterContext *ctx = inlink->dst;
@@ -199,6 +217,105 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
     return ff_filter_frame(outlink, picref);
 }
 
+#include "../fftools/ffmpeg.h"
+#include "libavcodec/avcodec.h"
+#include "../libavcodec/ass_split.h"
+
+#define ALPHA_THRESHOLD 0b10000000
+
+void render_avsub_ass(InputStream *, AVSubtitle *);
+void render_avsub_ass(InputStream *ist, AVSubtitle *sub)
+{
+    ASS_Library *library = ass_library_init();
+    ass_set_extract_fonts(library, 1);
+    ASS_Renderer *renderer = ass_renderer_init(library);
+    int w = 1920, h = 1080;
+    ass_set_frame_size(renderer, w, h);
+    ass_set_pixel_aspect(renderer, 1);
+    ass_set_storage_size(renderer, w, h);
+    ass_set_shaper(renderer, 0);
+    ass_set_fonts(renderer, NULL, NULL, 1, NULL, 1);
+
+    for (int r = 0; r < sub->num_rects; r++)
+    {
+        AVSubtitleRect *rect = sub->rects[r];
+        if (rect->data[0]) continue;
+
+        ASSSplitContext *ass_context = ff_ass_split((char *)ist->dec_ctx->subtitle_header);
+        ASSDialog *dialog = ff_ass_split_dialog(ass_context, rect->ass);
+
+        ASS_Track *track = ass_read_memory(library, (char *)ist->dec_ctx->subtitle_header, ist->dec_ctx->subtitle_header_size, NULL);
+        track->n_events = track->max_events = 1;
+        track->events = (ASS_Event *)malloc(sizeof(ASS_Event));
+        track->events[0].Start = sub->start_display_time + sub->pts / (AV_TIME_BASE / 1000);
+        track->events[0].Duration = sub->end_display_time - sub->start_display_time;
+        track->events[0].Effect = strdup(dialog->effect);
+        track->events[0].Layer = dialog->layer;
+        track->events[0].MarginL = dialog->margin_l;
+        track->events[0].MarginR = dialog->margin_r;
+        track->events[0].MarginV = dialog->margin_v;
+        track->events[0].Name = strdup(dialog->name);
+        track->events[0].Text = strdup(dialog->text);
+        track->events[0].ReadOrder = dialog->readorder;
+        track->events[0].Style = 0;
+        for (int style = 0; style < track->n_styles; style++)
+            if (!strcmp(track->styles[style].Name, dialog->style))
+                track->events[0].Style = style;
+        track->events[0].render_priv = NULL;
+        ff_ass_free_dialog(&dialog);
+        ff_ass_split_free(ass_context);
+
+        int change;
+        ASS_Image *image = ass_render_frame(renderer, track, track->events[0].Start + 1, &change);   // Don't have to free it for some reason
+        printf("image: %p\n", image);
+
+        rect->x = image->dst_x; rect->w = 0;
+        rect->y = image->dst_y; rect->h = 0;
+        rect->nb_colors = 1;    // Transparent background counts as a color
+        for (ASS_Image *img = image; img != NULL; img = img->next)
+        {
+            // Set image bounds to encompass all images
+            if (img->dst_x < rect->x) rect->x = img->dst_x;
+            if (img->dst_y < rect->y) rect->y = img->dst_y;
+            if (img->dst_x + img->w > rect->x + rect->w)
+                rect->w = img->dst_x + img->w - rect->x;
+            if (img->dst_y + img->h > rect->y + rect->h)
+                rect->h = img->dst_y + img->h - rect->y;
+            rect->nb_colors++;
+        }
+        rect->linesize[0] = rect->w;
+        rect->data[0] = (uint8_t *)malloc(rect->w * rect->h * sizeof(uint8_t));
+        rect->data[1] = (uint8_t *)malloc(4 * rect->nb_colors * sizeof(uint8_t));
+        memset(rect->data[0], 0, rect->w * rect->h);        // Set all to transparent
+        memset(rect->data[1], 0, 4);                        // Set transparent color
+        memset(&rect->linesize[1], 0, 3 * sizeof(int));
+        rect->data[2] = rect->data[3] = NULL;
+        for (int color = 1; image != NULL; image = image->next, color++)
+        {
+            // Set color
+            rect->data[1][4 * color + 0] = AR(image->color);
+            rect->data[1][4 * color + 1] = AG(image->color);
+            rect->data[1][4 * color + 2] = AB(image->color);
+            rect->data[1][4 * color + 3] = AA(image->color);
+            // Set pixels
+            for (int y = 0; y < image->h; y++)
+                for (int x = 0; x < image->w; x++)
+                    if (image->bitmap[y * image->stride + x] >= ALPHA_THRESHOLD)
+                    {
+                        int x_rect = image->dst_x + x - rect->x;
+                        int y_rect = image->dst_y + y - rect->y;
+                        rect->data[0][y_rect * rect->w + x_rect] = color;
+                    }
+        }
+        rect->type = SUBTITLE_BITMAP;
+
+        ass_free_track(track);
+    }
+
+    ass_renderer_done(renderer);
+    ass_library_done(library);
+}
+
 static const AVFilterPad ass_inputs[] = {
     {
         .name             = "default",
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 02/12] Render only when necessary
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 01/12] Implemented text to bitmap subtitles! Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 03/12] Retreive width and height from video stream! Traian Coza
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 fftools/ffmpeg.c           | 12 ++++++++++--
 libavfilter/vf_subtitles.c |  1 -
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 53717d3ebb..dea2aec2ce 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2422,9 +2422,8 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
         goto out;
 
     ist->frames_decoded++;
-    
-    render_avsub_ass(ist, &subtitle);
 
+    int rendered = 0;
     for (i = 0; i < nb_output_streams; i++) {
         OutputStream *ost = output_streams[i];
 
@@ -2432,6 +2431,15 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
             || ost->enc->type != AVMEDIA_TYPE_SUBTITLE)
             continue;
 
+        if (avcodec_descriptor_get(ost->enc_ctx->codec_id)->props & AV_CODEC_PROP_BITMAP_SUB)
+            if (avcodec_descriptor_get(ist->dec_ctx->codec_id)->props & AV_CODEC_PROP_TEXT_SUB)
+                if (!rendered) {
+                    render_avsub_ass(ist, &subtitle);
+                    for (int r = 0; r < subtitle.num_rects; r++)
+                        subtitle.rects[r]->type = SUBTITLE_BITMAP;
+                    rendered = 1;
+                }
+
         do_subtitle_out(output_files[ost->file_index], ost, &subtitle);
     }
 
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index f751786033..16f9c3fff6 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -307,7 +307,6 @@ void render_avsub_ass(InputStream *ist, AVSubtitle *sub)
                         rect->data[0][y_rect * rect->w + x_rect] = color;
                     }
         }
-        rect->type = SUBTITLE_BITMAP;
 
         ass_free_track(track);
     }
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 03/12] Retreive width and height from video stream!
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 01/12] Implemented text to bitmap subtitles! Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 02/12] Render only when necessary Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 04/12] Initialize ass library only once! Traian Coza
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 fftools/ffmpeg.c           | 29 ++++++++++++++++++++++++++---
 libavfilter/vf_subtitles.c |  9 ++++-----
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index dea2aec2ce..a74800bb68 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2325,7 +2325,7 @@ fail:
     return err < 0 ? err : ret;
 }
 
-void render_avsub_ass(InputStream *, AVSubtitle *);
+void render_avsub_ass(InputStream *, AVSubtitle *, int, int);
 
 static void print_subtitle(AVSubtitle sub)
 {
@@ -2423,7 +2423,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
 
     ist->frames_decoded++;
 
-    int rendered = 0;
+    int rendered = 0;       // Variable for text to bitmap support
     for (i = 0; i < nb_output_streams; i++) {
         OutputStream *ost = output_streams[i];
 
@@ -2431,10 +2431,33 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
             || ost->enc->type != AVMEDIA_TYPE_SUBTITLE)
             continue;
 
+        // Support text to bitmap
         if (avcodec_descriptor_get(ost->enc_ctx->codec_id)->props & AV_CODEC_PROP_BITMAP_SUB)
             if (avcodec_descriptor_get(ist->dec_ctx->codec_id)->props & AV_CODEC_PROP_TEXT_SUB)
                 if (!rendered) {
-                    render_avsub_ass(ist, &subtitle);
+                    // Try to get a height and width from a video
+                    int width = 0, height = 0;
+                    // Try output streams
+                    for (int j = 0; j < nb_output_streams; j++)
+                        if (output_streams[j]->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
+                        {
+                            width = output_streams[j]->enc_ctx->width;
+                            height = output_streams[j]->enc_ctx->height;
+                            break;
+                        }
+                    if (width == 0)
+                        // Try input streams
+                        for (int j = 0; j < nb_input_streams; j++)
+                            if (input_streams[j]->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
+                            {
+                                width = input_streams[j]->dec_ctx->width;
+                                height = input_streams[j]->dec_ctx->height;
+                                break;
+                            }
+                    if (width == 0) {
+                        // TODO Error: Cannot render without a video stream
+                    }
+                    render_avsub_ass(ist, &subtitle, width, height);
                     for (int r = 0; r < subtitle.num_rects; r++)
                         subtitle.rects[r]->type = SUBTITLE_BITMAP;
                     rendered = 1;
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index 16f9c3fff6..7226911f6c 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -223,16 +223,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
 
 #define ALPHA_THRESHOLD 0b10000000
 
-void render_avsub_ass(InputStream *, AVSubtitle *);
-void render_avsub_ass(InputStream *ist, AVSubtitle *sub)
+void render_avsub_ass(InputStream *, AVSubtitle *, int, int);
+void render_avsub_ass(InputStream *ist, AVSubtitle *sub, int frame_width, int frame_height)
 {
     ASS_Library *library = ass_library_init();
     ass_set_extract_fonts(library, 1);
     ASS_Renderer *renderer = ass_renderer_init(library);
-    int w = 1920, h = 1080;
-    ass_set_frame_size(renderer, w, h);
+    ass_set_frame_size(renderer, frame_width, frame_height);
     ass_set_pixel_aspect(renderer, 1);
-    ass_set_storage_size(renderer, w, h);
+    ass_set_storage_size(renderer, frame_width, frame_height);
     ass_set_shaper(renderer, 0);
     ass_set_fonts(renderer, NULL, NULL, 1, NULL, 1);
 
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 04/12] Initialize ass library only once!
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
                   ` (2 preceding siblings ...)
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 03/12] Retreive width and height from video stream! Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 05/12] Cleaned up Traian Coza
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 fftools/ffmpeg.c            |  50 ++++-------
 libavcodec/Makefile         |   1 +
 libavcodec/avcodec.h        |   9 ++
 libavcodec/text_to_bitmap.c | 170 ++++++++++++++++++++++++++++++++++++
 libavcodec/text_to_bitmap.h |  18 ++++
 libavfilter/vf_subtitles.c  |  97 --------------------
 6 files changed, 217 insertions(+), 128 deletions(-)
 create mode 100644 libavcodec/text_to_bitmap.c
 create mode 100644 libavcodec/text_to_bitmap.h

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index a74800bb68..31acf08a6a 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -71,6 +71,10 @@
 # include "libavfilter/buffersrc.h"
 # include "libavfilter/buffersink.h"
 
+#if CONFIG_LIBASS
+#include "libavcodec/text_to_bitmap.h"
+#endif
+
 #if HAVE_SYS_RESOURCE_H
 #include <sys/time.h>
 #include <sys/types.h>
@@ -2325,8 +2329,6 @@ fail:
     return err < 0 ? err : ret;
 }
 
-void render_avsub_ass(InputStream *, AVSubtitle *, int, int);
-
 static void print_subtitle(AVSubtitle sub)
 {
     printf("sub.format: %u\n", sub.format);
@@ -2434,30 +2436,8 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
         // Support text to bitmap
         if (avcodec_descriptor_get(ost->enc_ctx->codec_id)->props & AV_CODEC_PROP_BITMAP_SUB)
             if (avcodec_descriptor_get(ist->dec_ctx->codec_id)->props & AV_CODEC_PROP_TEXT_SUB)
-                if (!rendered) {
-                    // Try to get a height and width from a video
-                    int width = 0, height = 0;
-                    // Try output streams
-                    for (int j = 0; j < nb_output_streams; j++)
-                        if (output_streams[j]->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
-                        {
-                            width = output_streams[j]->enc_ctx->width;
-                            height = output_streams[j]->enc_ctx->height;
-                            break;
-                        }
-                    if (width == 0)
-                        // Try input streams
-                        for (int j = 0; j < nb_input_streams; j++)
-                            if (input_streams[j]->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
-                            {
-                                width = input_streams[j]->dec_ctx->width;
-                                height = input_streams[j]->dec_ctx->height;
-                                break;
-                            }
-                    if (width == 0) {
-                        // TODO Error: Cannot render without a video stream
-                    }
-                    render_avsub_ass(ist, &subtitle, width, height);
+                if (!rendered) {        // Make sure not to render twice
+                    render_avsub_ass(ist->dec_ctx->ass_context, &subtitle);
                     for (int r = 0; r < subtitle.num_rects; r++)
                         subtitle.rects[r]->type = SUBTITLE_BITMAP;
                     rendered = 1;
@@ -2757,6 +2737,9 @@ static int init_input_stream(int ist_index, char *error, int error_len)
          * audio, and video decoders such as cuvid or mediacodec */
         ist->dec_ctx->pkt_timebase = ist->st->time_base;
 
+        // For text to bitmap rendering
+        ist->dec_ctx->ass_context = NULL;
+
         if (!av_dict_get(ist->decoder_opts, "threads", NULL, 0))
             av_dict_set(&ist->decoder_opts, "threads", "auto", 0);
         /* Attached pics are sparse, therefore we would not want to delay their decoding till EOF. */
@@ -3285,16 +3268,21 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame,
                 input_props = input_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
             if (output_descriptor)
                 output_props = output_descriptor->props & (AV_CODEC_PROP_TEXT_SUB | AV_CODEC_PROP_BITMAP_SUB);
-            /*if (input_props && output_props && input_props != output_props) {
+#if CONFIG_LIBASS
+            if (input_props == AV_CODEC_PROP_BITMAP_SUB && output_props == AV_CODEC_PROP_TEXT_SUB) {
+                snprintf(error, error_len, "Subtitle encoding from bitmap to text currently not possible");
+                return AVERROR_INVALIDDATA;
+            }
+            if (input_props == AV_CODEC_PROP_TEXT_SUB && output_props == AV_CODEC_PROP_BITMAP_SUB)
+                init_ass_context(ist, ost);
+#else
+            if (input_props && output_props && input_props != output_props) {
                 snprintf(error, error_len,
                          "Subtitle encoding currently only possible from text to text "
                          "or bitmap to bitmap");
                 return AVERROR_INVALIDDATA;
-            }*/
-            if (input_props == AV_CODEC_PROP_BITMAP_SUB && output_props == AV_CODEC_PROP_TEXT_SUB) {
-                snprintf(error, error_len, "Subtitle encoding from bitmap to text currently not possible");
-                return AVERROR_INVALIDDATA;
             }
+#endif
         }
 
         if ((ret = avcodec_open2(ost->enc_ctx, codec, &ost->encoder_opts)) < 0) {
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index cfaa6f196a..6d28513129 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -151,6 +151,7 @@ OBJS-$(CONFIG_RV34DSP)                 += rv34dsp.o
 OBJS-$(CONFIG_SINEWIN)                 += sinewin.o
 OBJS-$(CONFIG_SNAPPY)                  += snappy.o
 OBJS-$(CONFIG_STARTCODE)               += startcode.o
+OBJS-$(CONFIG_LIBASS)                  += text_to_bitmap.o
 OBJS-$(CONFIG_TEXTUREDSP)              += texturedsp.o
 OBJS-$(CONFIG_TEXTUREDSPENC)           += texturedspenc.o
 OBJS-$(CONFIG_TPELDSP)                 += tpeldsp.o
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4dae23d06e..530c01f193 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2055,6 +2055,15 @@ typedef struct AVCodecContext {
      *             The decoder can then override during decoding as needed.
      */
     AVChannelLayout ch_layout;
+
+    /**
+     * Pointer to ASS_Library instance (cast to void *)
+     * - encoding: unused
+     * - decoding: is set to NULL initially in init_input_stream, and if
+     *             there must be a text to bitmap conversion, is set to a
+     *             new instance of ASS_Library in init_output_stream
+     */
+     void *ass_context;
 } AVCodecContext;
 
 /**
diff --git a/libavcodec/text_to_bitmap.c b/libavcodec/text_to_bitmap.c
new file mode 100644
index 0000000000..87c46985d9
--- /dev/null
+++ b/libavcodec/text_to_bitmap.c
@@ -0,0 +1,170 @@
+//
+// Created by traian on 2022-05-02.
+//
+
+#include "text_to_bitmap.h"
+
+#include "fftools/ffmpeg.h"
+#include "avcodec.h"
+#include "ass_split.h"
+
+struct ASS_Context {
+    ASS_Library *library;
+    ASS_Renderer *renderer;
+    ASS_Track *track;
+    ASSSplitContext *ass_split_context;
+};
+
+void init_ass_context(InputStream *ist, OutputStream *ost)
+{
+    if (ist->dec_ctx->ass_context) return;
+    ASS_Context *context = (ASS_Context *)malloc(sizeof(ASS_Context));
+    context->library = ass_library_init();
+    ass_set_extract_fonts(context->library, 1);
+    // TODO: ass_add_font(context->library, );
+
+    // Try to get a height and width from somewhere
+    int width = 0, height = 0;
+    do
+    {
+        // Try input stream
+        if (ost->enc_ctx->width != 0 && ost->enc_ctx->height != 0)
+        {
+            width = ost->enc_ctx->width;
+            height = ost->enc_ctx->height;
+            break;
+        }
+        // Try output stream
+        if (ist->dec_ctx->width != 0 && ist->dec_ctx->height != 0)
+        {
+            width = ist->dec_ctx->width;
+            height = ist->dec_ctx->height;
+            break;
+        }
+        // Try output streams
+        for (int j = 0; j < nb_output_streams; j++)
+            if (output_streams[j]->enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
+            {
+                width = output_streams[j]->enc_ctx->width;
+                height = output_streams[j]->enc_ctx->height;
+                break;
+            }
+        if (width && height) break;
+        // Try input streams
+        for (int j = 0; j < nb_input_streams; j++)
+            if (input_streams[j]->dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO)
+            {
+                width = input_streams[j]->dec_ctx->width;
+                height = input_streams[j]->dec_ctx->height;
+                break;
+            }
+        if (width && height) break;
+
+        // TODO Error: Cannot render without a width and height
+    } while (0);
+
+    context->renderer = ass_renderer_init(context->library);
+    ass_set_frame_size(context->renderer, width, height);
+    ass_set_pixel_aspect(context->renderer, 1);
+    ass_set_storage_size(context->renderer, width, height);
+    ass_set_shaper(context->renderer, 0);
+    ass_set_fonts(context->renderer, NULL, NULL, 1, NULL, 1);
+
+    context->track = ass_read_memory(context->library, (char *)ist->dec_ctx->subtitle_header, ist->dec_ctx->subtitle_header_size, NULL);
+    context->ass_split_context = ff_ass_split((char *)ist->dec_ctx->subtitle_header);
+
+    ist->dec_ctx->ass_context = context;
+}
+
+void free_ass_context(ASS_Context *context) {
+    ass_library_done(context->library);
+    ass_renderer_done(context->renderer);
+    ass_free_track(context->track);
+    ff_ass_split_free(context->ass_split_context);
+    free(context);
+}
+
+/* libass stores an RGBA color in the format RRGGBBTT, where TT is the transparency level */
+#define AR(c)  ((c)>>24)
+#define AG(c)  (((c)>>16)&0xFF)
+#define AB(c)  (((c)>>8) &0xFF)
+#define AA(c)  ((0xFF-(c)) &0xFF)
+
+#define ALPHA_THRESHOLD 0b10000000
+
+void render_avsub_ass(ASS_Context *context, AVSubtitle *sub)
+{
+    printf("render_avsub_ass\n");
+    for (int r = 0; r < sub->num_rects; r++)
+    {
+        AVSubtitleRect *rect = sub->rects[r];
+        if (rect->data[0]) continue;
+
+        ASSDialog *dialog = ff_ass_split_dialog(context->ass_split_context, rect->ass);
+        ASS_Track *track = context->track;
+        if (track->n_events > 0)
+            ass_free_event(track, 0);
+        track->n_events = 0;
+        ass_alloc_event(track);
+        track->n_events = track->max_events = 1;
+        track->events[0].Start = sub->start_display_time + sub->pts / (AV_TIME_BASE / 1000);
+        track->events[0].Duration = sub->end_display_time - sub->start_display_time;
+        track->events[0].Effect = strdup(dialog->effect);
+        track->events[0].Layer = dialog->layer;
+        track->events[0].MarginL = dialog->margin_l;
+        track->events[0].MarginR = dialog->margin_r;
+        track->events[0].MarginV = dialog->margin_v;
+        track->events[0].Name = strdup(dialog->name);
+        track->events[0].Text = strdup(dialog->text);
+        track->events[0].ReadOrder = dialog->readorder;
+        track->events[0].Style = 0;
+        for (int style = 0; style < track->n_styles; style++)
+            if (!strcmp(track->styles[style].Name, dialog->style))
+                track->events[0].Style = style;
+        track->events[0].render_priv = NULL;
+        ff_ass_free_dialog(&dialog);
+
+        ASS_Image *image = ass_render_frame(context->renderer, track,
+            track->events[0].Start + track->events[0].Duration / 2, NULL);
+        if (image == NULL) printf("WARNING: failed to render ass\n");
+
+        rect->x = image ? image->dst_x : 0; rect->w = 0;
+        rect->y = image ? image->dst_y : 0; rect->h = 0;
+        rect->nb_colors = 1;    // Transparent background counts as a color
+        for (ASS_Image *img = image; img != NULL; img = img->next)
+        {
+            // Set image bounds to encompass all images
+            if (img->dst_x < rect->x) rect->x = img->dst_x;
+            if (img->dst_y < rect->y) rect->y = img->dst_y;
+            if (img->dst_x + img->w > rect->x + rect->w)
+                rect->w = img->dst_x + img->w - rect->x;
+            if (img->dst_y + img->h > rect->y + rect->h)
+                rect->h = img->dst_y + img->h - rect->y;
+            rect->nb_colors++;
+        }
+        rect->linesize[0] = rect->w;
+        rect->data[0] = (uint8_t *)malloc(rect->w * rect->h * sizeof(uint8_t));
+        rect->data[1] = (uint8_t *)malloc(4 * rect->nb_colors * sizeof(uint8_t));
+        memset(rect->data[0], 0, rect->w * rect->h);        // Set all to transparent
+        memset(rect->data[1], 0, 4);                        // Set transparent color
+        memset(&rect->linesize[1], 0, 3 * sizeof(int));
+        rect->data[2] = rect->data[3] = NULL;
+        for (int color = 1; image != NULL; image = image->next, color++)
+        {
+            // Set color
+            rect->data[1][4 * color + 0] = AR(image->color);
+            rect->data[1][4 * color + 1] = AG(image->color);
+            rect->data[1][4 * color + 2] = AB(image->color);
+            rect->data[1][4 * color + 3] = AA(image->color);
+            // Set pixels
+            for (int y = 0; y < image->h; y++)
+                for (int x = 0; x < image->w; x++)
+                    if (image->bitmap[y * image->stride + x] >= ALPHA_THRESHOLD)
+                    {
+                        int x_rect = image->dst_x + x - rect->x;
+                        int y_rect = image->dst_y + y - rect->y;
+                        rect->data[0][y_rect * rect->w + x_rect] = color;
+                    }
+        }
+    }
+}
\ No newline at end of file
diff --git a/libavcodec/text_to_bitmap.h b/libavcodec/text_to_bitmap.h
new file mode 100644
index 0000000000..4cba5889f4
--- /dev/null
+++ b/libavcodec/text_to_bitmap.h
@@ -0,0 +1,18 @@
+//
+// Created by traian on 2022-05-02.
+//
+
+#ifndef FFMPEG_TEXT_TO_BITMAP_H
+#define FFMPEG_TEXT_TO_BITMAP_H
+
+#include <ass/ass.h>
+#include "fftools/ffmpeg.h"
+
+struct ASS_Context;
+typedef struct ASS_Context ASS_Context;
+
+void init_ass_context(InputStream *ist, OutputStream *ost);
+void render_avsub_ass(ASS_Context *, AVSubtitle *);
+void free_ass_context(ASS_Context *context);
+
+#endif //FFMPEG_TEXT_TO_BITMAP_H
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index 7226911f6c..703dbec37d 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -217,103 +217,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
     return ff_filter_frame(outlink, picref);
 }
 
-#include "../fftools/ffmpeg.h"
-#include "libavcodec/avcodec.h"
-#include "../libavcodec/ass_split.h"
-
-#define ALPHA_THRESHOLD 0b10000000
-
-void render_avsub_ass(InputStream *, AVSubtitle *, int, int);
-void render_avsub_ass(InputStream *ist, AVSubtitle *sub, int frame_width, int frame_height)
-{
-    ASS_Library *library = ass_library_init();
-    ass_set_extract_fonts(library, 1);
-    ASS_Renderer *renderer = ass_renderer_init(library);
-    ass_set_frame_size(renderer, frame_width, frame_height);
-    ass_set_pixel_aspect(renderer, 1);
-    ass_set_storage_size(renderer, frame_width, frame_height);
-    ass_set_shaper(renderer, 0);
-    ass_set_fonts(renderer, NULL, NULL, 1, NULL, 1);
-
-    for (int r = 0; r < sub->num_rects; r++)
-    {
-        AVSubtitleRect *rect = sub->rects[r];
-        if (rect->data[0]) continue;
-
-        ASSSplitContext *ass_context = ff_ass_split((char *)ist->dec_ctx->subtitle_header);
-        ASSDialog *dialog = ff_ass_split_dialog(ass_context, rect->ass);
-
-        ASS_Track *track = ass_read_memory(library, (char *)ist->dec_ctx->subtitle_header, ist->dec_ctx->subtitle_header_size, NULL);
-        track->n_events = track->max_events = 1;
-        track->events = (ASS_Event *)malloc(sizeof(ASS_Event));
-        track->events[0].Start = sub->start_display_time + sub->pts / (AV_TIME_BASE / 1000);
-        track->events[0].Duration = sub->end_display_time - sub->start_display_time;
-        track->events[0].Effect = strdup(dialog->effect);
-        track->events[0].Layer = dialog->layer;
-        track->events[0].MarginL = dialog->margin_l;
-        track->events[0].MarginR = dialog->margin_r;
-        track->events[0].MarginV = dialog->margin_v;
-        track->events[0].Name = strdup(dialog->name);
-        track->events[0].Text = strdup(dialog->text);
-        track->events[0].ReadOrder = dialog->readorder;
-        track->events[0].Style = 0;
-        for (int style = 0; style < track->n_styles; style++)
-            if (!strcmp(track->styles[style].Name, dialog->style))
-                track->events[0].Style = style;
-        track->events[0].render_priv = NULL;
-        ff_ass_free_dialog(&dialog);
-        ff_ass_split_free(ass_context);
-
-        int change;
-        ASS_Image *image = ass_render_frame(renderer, track, track->events[0].Start + 1, &change);   // Don't have to free it for some reason
-        printf("image: %p\n", image);
-
-        rect->x = image->dst_x; rect->w = 0;
-        rect->y = image->dst_y; rect->h = 0;
-        rect->nb_colors = 1;    // Transparent background counts as a color
-        for (ASS_Image *img = image; img != NULL; img = img->next)
-        {
-            // Set image bounds to encompass all images
-            if (img->dst_x < rect->x) rect->x = img->dst_x;
-            if (img->dst_y < rect->y) rect->y = img->dst_y;
-            if (img->dst_x + img->w > rect->x + rect->w)
-                rect->w = img->dst_x + img->w - rect->x;
-            if (img->dst_y + img->h > rect->y + rect->h)
-                rect->h = img->dst_y + img->h - rect->y;
-            rect->nb_colors++;
-        }
-        rect->linesize[0] = rect->w;
-        rect->data[0] = (uint8_t *)malloc(rect->w * rect->h * sizeof(uint8_t));
-        rect->data[1] = (uint8_t *)malloc(4 * rect->nb_colors * sizeof(uint8_t));
-        memset(rect->data[0], 0, rect->w * rect->h);        // Set all to transparent
-        memset(rect->data[1], 0, 4);                        // Set transparent color
-        memset(&rect->linesize[1], 0, 3 * sizeof(int));
-        rect->data[2] = rect->data[3] = NULL;
-        for (int color = 1; image != NULL; image = image->next, color++)
-        {
-            // Set color
-            rect->data[1][4 * color + 0] = AR(image->color);
-            rect->data[1][4 * color + 1] = AG(image->color);
-            rect->data[1][4 * color + 2] = AB(image->color);
-            rect->data[1][4 * color + 3] = AA(image->color);
-            // Set pixels
-            for (int y = 0; y < image->h; y++)
-                for (int x = 0; x < image->w; x++)
-                    if (image->bitmap[y * image->stride + x] >= ALPHA_THRESHOLD)
-                    {
-                        int x_rect = image->dst_x + x - rect->x;
-                        int y_rect = image->dst_y + y - rect->y;
-                        rect->data[0][y_rect * rect->w + x_rect] = color;
-                    }
-        }
-
-        ass_free_track(track);
-    }
-
-    ass_renderer_done(renderer);
-    ass_library_done(library);
-}
-
 static const AVFilterPad ass_inputs[] = {
     {
         .name             = "default",
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 05/12] Cleaned up
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
                   ` (3 preceding siblings ...)
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 04/12] Initialize ass library only once! Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 06/12] Wrote proper headers Traian Coza
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 fftools/ffmpeg.c            | 39 ++-----------------------
 libavcodec/text_to_bitmap.c | 58 +++++++++++++++++++++++++++++++++++--
 libavfilter/vf_subtitles.c  | 18 ------------
 3 files changed, 58 insertions(+), 57 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 31acf08a6a..0ff9da7bf4 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2329,43 +2329,6 @@ fail:
     return err < 0 ? err : ret;
 }
 
-static void print_subtitle(AVSubtitle sub)
-{
-    printf("sub.format: %u\n", sub.format);
-    printf("sub.start_display_time: %u\n", sub.start_display_time);
-    printf("sub.end_display_time: %u\n", sub.end_display_time);
-    printf("sub.num_rects: %u\n", sub.num_rects);
-    printf("sub.pts: %ld\n", sub.pts);
-    for (int i = 0; i < sub.num_rects; i++)
-    {
-        printf("sub.rects[%d]->type: %d\n", i, sub.rects[i]->type);
-        printf("sub.rects[%d]->nb_colors: %d\n", i, sub.rects[i]->nb_colors);
-        printf("sub.rects[%d]->(x,y,w,h): (%d,%d,%d,%d)\n", i, sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h);
-        printf("sub.rects[%d]->linesize: [%d,%d,%d,%d]\n", i, sub.rects[i]->linesize[0], sub.rects[i]->linesize[1], sub.rects[i]->linesize[1], sub.rects[i]->linesize[1]);
-        switch (sub.rects[i]->type)
-        {
-            case SUBTITLE_TEXT:
-                printf("sub.rects[%d]->text: %s\n", i, sub.rects[i]->text);
-                break;
-            case SUBTITLE_ASS:
-                printf("sub.rects[%d]->ass: %s\n", i, sub.rects[i]->ass);
-                break;
-            case SUBTITLE_BITMAP:
-                for (int c = 0; c < sub.rects[i]->nb_colors; c++)
-                    printf("color %d: [%u,%u,%u,%u]\n", c,
-                           sub.rects[i]->data[1][c * 4 + 0],
-                           sub.rects[i]->data[1][c * 4 + 1],
-                           sub.rects[i]->data[1][c * 4 + 2],
-                           sub.rects[i]->data[1][c * 4 + 3]);
-                for (int y = 0; y < sub.rects[i]->h; y++, printf("\n"))
-                    for (int x = 0; x < sub.rects[i]->w; x++)
-                        printf("%d", sub.rects[i]->data[0][y * sub.rects[i]->w + x]);
-                break;
-        }
-    }
-    printf("\n");
-}
-
 static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
                                int *decode_failed)
 {
@@ -2433,6 +2396,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
             || ost->enc->type != AVMEDIA_TYPE_SUBTITLE)
             continue;
 
+#if CONFIG_LIBASS
         // Support text to bitmap
         if (avcodec_descriptor_get(ost->enc_ctx->codec_id)->props & AV_CODEC_PROP_BITMAP_SUB)
             if (avcodec_descriptor_get(ist->dec_ctx->codec_id)->props & AV_CODEC_PROP_TEXT_SUB)
@@ -2442,6 +2406,7 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output,
                         subtitle.rects[r]->type = SUBTITLE_BITMAP;
                     rendered = 1;
                 }
+#endif
 
         do_subtitle_out(output_files[ost->file_index], ost, &subtitle);
     }
diff --git a/libavcodec/text_to_bitmap.c b/libavcodec/text_to_bitmap.c
index 87c46985d9..50c72afc55 100644
--- a/libavcodec/text_to_bitmap.c
+++ b/libavcodec/text_to_bitmap.c
@@ -94,7 +94,6 @@ void free_ass_context(ASS_Context *context) {
 
 void render_avsub_ass(ASS_Context *context, AVSubtitle *sub)
 {
-    printf("render_avsub_ass\n");
     for (int r = 0; r < sub->num_rects; r++)
     {
         AVSubtitleRect *rect = sub->rects[r];
@@ -167,4 +166,59 @@ void render_avsub_ass(ASS_Context *context, AVSubtitle *sub)
                     }
         }
     }
-}
\ No newline at end of file
+}
+
+static void print_ass_image(const ASS_Image *image)
+{
+    int index = 0;
+    for (; image != NULL; image = image->next, index++)
+    {
+        printf("index: %d\n", index);
+        printf("image->(dst_x,dst_y): (%d,%d)\n", image->dst_x, image->dst_y);
+        printf("image->(w,h): (%d,%d)\n", image->w, image->h);
+        printf("image->stride: %d\n", image->stride);
+        printf("image->type: %d\n", image->type);
+        printf("image->color: [%u,%u,%u,%u]\n", AR(image->color), AG(image->color), AB(image->color), AA(image->color));
+        for (int y = 0; y < image->h; y++, printf("\n"))
+            for (int x = 0; x < image->w; x++)
+                printf("%02X", image->bitmap[y * image->stride + x]);
+        printf("\n");
+    }
+}
+
+static void print_subtitle(AVSubtitle sub)
+{
+    printf("sub.format: %u\n", sub.format);
+    printf("sub.start_display_time: %u\n", sub.start_display_time);
+    printf("sub.end_display_time: %u\n", sub.end_display_time);
+    printf("sub.num_rects: %u\n", sub.num_rects);
+    printf("sub.pts: %ld\n", sub.pts);
+    for (int i = 0; i < sub.num_rects; i++)
+    {
+        printf("sub.rects[%d]->type: %d\n", i, sub.rects[i]->type);
+        printf("sub.rects[%d]->nb_colors: %d\n", i, sub.rects[i]->nb_colors);
+        printf("sub.rects[%d]->(x,y,w,h): (%d,%d,%d,%d)\n", i, sub.rects[i]->x, sub.rects[i]->y, sub.rects[i]->w, sub.rects[i]->h);
+        printf("sub.rects[%d]->linesize: [%d,%d,%d,%d]\n", i, sub.rects[i]->linesize[0], sub.rects[i]->linesize[1], sub.rects[i]->linesize[1], sub.rects[i]->linesize[1]);
+        switch (sub.rects[i]->type)
+        {
+            case SUBTITLE_TEXT:
+                printf("sub.rects[%d]->text: %s\n", i, sub.rects[i]->text);
+                break;
+            case SUBTITLE_ASS:
+                printf("sub.rects[%d]->ass: %s\n", i, sub.rects[i]->ass);
+                break;
+            case SUBTITLE_BITMAP:
+                for (int c = 0; c < sub.rects[i]->nb_colors; c++)
+                    printf("color %d: [%u,%u,%u,%u]\n", c,
+                           sub.rects[i]->data[1][c * 4 + 0],
+                           sub.rects[i]->data[1][c * 4 + 1],
+                           sub.rects[i]->data[1][c * 4 + 2],
+                           sub.rects[i]->data[1][c * 4 + 3]);
+                for (int y = 0; y < sub.rects[i]->h; y++, printf("\n"))
+                    for (int x = 0; x < sub.rects[i]->w; x++)
+                        printf("%d", sub.rects[i]->data[0][y * sub.rects[i]->w + x]);
+                break;
+        }
+    }
+    printf("\n");
+}
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index 703dbec37d..82e140e986 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -181,24 +181,6 @@ static void overlay_ass_image(AssContext *ass, AVFrame *picref,
     }
 }
 
-static void print_ass_image(const ASS_Image *image)
-{
-    int index = 0;
-    for (; image != NULL; image = image->next, index++)
-    {
-        printf("index: %d\n", index);
-        printf("image->(dst_x,dst_y): (%d,%d)\n", image->dst_x, image->dst_y);
-        printf("image->(w,h): (%d,%d)\n", image->w, image->h);
-        printf("image->stride: %d\n", image->stride);
-        printf("image->type: %d\n", image->type);
-        printf("image->color: [%u,%u,%u,%u]\n", AR(image->color), AG(image->color), AB(image->color), AA(image->color));
-        for (int y = 0; y < image->h; y++, printf("\n"))
-            for (int x = 0; x < image->w; x++)
-                printf("%02X", image->bitmap[y * image->stride + x]);
-        printf("\n");
-    }
-}
-
 static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
 {
     AVFilterContext *ctx = inlink->dst;
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 06/12] Wrote proper headers
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
                   ` (4 preceding siblings ...)
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 05/12] Cleaned up Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 07/12] Close libass after using Traian Coza
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 libavcodec/text_to_bitmap.c | 9 ++++++---
 libavcodec/text_to_bitmap.h | 6 +++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavcodec/text_to_bitmap.c b/libavcodec/text_to_bitmap.c
index 50c72afc55..273564cb67 100644
--- a/libavcodec/text_to_bitmap.c
+++ b/libavcodec/text_to_bitmap.c
@@ -1,6 +1,9 @@
-//
-// Created by traian on 2022-05-02.
-//
+/**
+ * text to bitmap support code.
+ *
+ * This file contains a function to initiate the functionality for a stream,
+ * to render any AVSubtitle structure, and to free the structures allocated at the start
+ */
 
 #include "text_to_bitmap.h"
 
diff --git a/libavcodec/text_to_bitmap.h b/libavcodec/text_to_bitmap.h
index 4cba5889f4..37d346ae0c 100644
--- a/libavcodec/text_to_bitmap.h
+++ b/libavcodec/text_to_bitmap.h
@@ -1,6 +1,6 @@
-//
-// Created by traian on 2022-05-02.
-//
+/**
+ * text_to_bitmap header file
+ */
 
 #ifndef FFMPEG_TEXT_TO_BITMAP_H
 #define FFMPEG_TEXT_TO_BITMAP_H
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 07/12] Close libass after using
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
                   ` (5 preceding siblings ...)
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 06/12] Wrote proper headers Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 08/12] Added standard headers Traian Coza
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 fftools/ffmpeg.c            |  2 +-
 libavcodec/avcodec.c        |  9 +++++++++
 libavcodec/text_to_bitmap.c | 13 +++++++++++--
 libavcodec/text_to_bitmap.h |  8 +++++++-
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 0ff9da7bf4..ae622492ee 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3239,7 +3239,7 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame,
                 return AVERROR_INVALIDDATA;
             }
             if (input_props == AV_CODEC_PROP_TEXT_SUB && output_props == AV_CODEC_PROP_BITMAP_SUB)
-                init_ass_context(ist, ost);
+                init_ass_context(input_streams, output_streams, nb_input_streams, nb_output_streams, ost->source_index, ost->index);
 #else
             if (input_props && output_props && input_props != output_props) {
                 snprintf(error, error_len,
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index d11f035481..1e308f39c2 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -42,6 +42,10 @@
 #include "thread.h"
 #include "version.h"
 
+#if CONFIG_LIBASS
+#include "libavcodec/text_to_bitmap.h"
+#endif
+
 #include "libavutil/ffversion.h"
 const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
 
@@ -534,6 +538,11 @@ av_cold int avcodec_close(AVCodecContext *avctx)
     } else if (av_codec_is_decoder(avctx->codec))
         av_freep(&avctx->subtitle_header);
 
+#if CONFIG_LIBASS
+    if (av_codec_is_decoder(avctx->codec) && avctx->ass_context != NULL)
+        free_ass_context(avctx->ass_context);
+#endif
+
     avctx->codec = NULL;
     avctx->active_thread_type = 0;
 
diff --git a/libavcodec/text_to_bitmap.c b/libavcodec/text_to_bitmap.c
index 273564cb67..c419e89c20 100644
--- a/libavcodec/text_to_bitmap.c
+++ b/libavcodec/text_to_bitmap.c
@@ -18,13 +18,22 @@ struct ASS_Context {
     ASSSplitContext *ass_split_context;
 };
 
-void init_ass_context(InputStream *ist, OutputStream *ost)
+void init_ass_context(
+        InputStream **input_streams,
+        OutputStream **output_streams,
+        int nb_input_streams,
+        int nb_output_streams,
+        int ist_i,
+        int ost_i)
 {
+    InputStream *ist = input_streams[ist_i];
+    OutputStream *ost = output_streams[ost_i];
     if (ist->dec_ctx->ass_context) return;
+
     ASS_Context *context = (ASS_Context *)malloc(sizeof(ASS_Context));
     context->library = ass_library_init();
     ass_set_extract_fonts(context->library, 1);
-    // TODO: ass_add_font(context->library, );
+    // TODO: ass_add_font(context->library, ...);
 
     // Try to get a height and width from somewhere
     int width = 0, height = 0;
diff --git a/libavcodec/text_to_bitmap.h b/libavcodec/text_to_bitmap.h
index 37d346ae0c..0c4689b039 100644
--- a/libavcodec/text_to_bitmap.h
+++ b/libavcodec/text_to_bitmap.h
@@ -11,7 +11,13 @@
 struct ASS_Context;
 typedef struct ASS_Context ASS_Context;
 
-void init_ass_context(InputStream *ist, OutputStream *ost);
+void init_ass_context(
+        InputStream **input_streams,
+        OutputStream **output_streams,
+        int nb_input_streams,
+        int nb_output_streams,
+        int ist_i,
+        int ost_i);
 void render_avsub_ass(ASS_Context *, AVSubtitle *);
 void free_ass_context(ASS_Context *context);
 
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 08/12] Added standard headers
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
                   ` (6 preceding siblings ...)
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 07/12] Close libass after using Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 09/12] Rearranged files, all tests are passing! Traian Coza
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 libavcodec/text_to_bitmap.c | 47 ++++++++++++++++++++++++++++++++++++-
 libavcodec/text_to_bitmap.h | 25 +++++++++++++++++---
 2 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/libavcodec/text_to_bitmap.c b/libavcodec/text_to_bitmap.c
index c419e89c20..52d161d7b1 100644
--- a/libavcodec/text_to_bitmap.c
+++ b/libavcodec/text_to_bitmap.c
@@ -1,4 +1,23 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
 /**
+ * @file
  * text to bitmap support code.
  *
  * This file contains a function to initiate the functionality for a stream,
@@ -11,6 +30,9 @@
 #include "avcodec.h"
 #include "ass_split.h"
 
+/**
+ * Holds the objects used by the rendering function so they don't have to be reinitialized every time
+ */
 struct ASS_Context {
     ASS_Library *library;
     ASS_Renderer *renderer;
@@ -18,6 +40,17 @@ struct ASS_Context {
     ASSSplitContext *ass_split_context;
 };
 
+/**
+ * Initiates the ASS_Context structure and adds it to the input stream decoder context.
+ * Does nothing if ist->dec_ctx->ass_context is already set.
+ * It needs all these arguments because it searches for a frame size in all the streams
+ * @param input_streams
+ * @param output_streams
+ * @param nb_input_streams
+ * @param nb_output_streams
+ * @param ist_i index of input stream for transcoding
+ * @param ost_i index of output stream for transcoding
+ */
 void init_ass_context(
         InputStream **input_streams,
         OutputStream **output_streams,
@@ -82,12 +115,17 @@ void init_ass_context(
     ass_set_shaper(context->renderer, 0);
     ass_set_fonts(context->renderer, NULL, NULL, 1, NULL, 1);
 
-    context->track = ass_read_memory(context->library, (char *)ist->dec_ctx->subtitle_header, ist->dec_ctx->subtitle_header_size, NULL);
+    context->track = ass_read_memory(context->library,
+        (char *)ist->dec_ctx->subtitle_header, ist->dec_ctx->subtitle_header_size, NULL);
     context->ass_split_context = ff_ass_split((char *)ist->dec_ctx->subtitle_header);
 
     ist->dec_ctx->ass_context = context;
 }
 
+/**
+ * Frees what was allocated in init_ass_context
+ * @param context
+ */
 void free_ass_context(ASS_Context *context) {
     ass_library_done(context->library);
     ass_renderer_done(context->renderer);
@@ -104,6 +142,11 @@ void free_ass_context(ASS_Context *context) {
 
 #define ALPHA_THRESHOLD 0b10000000
 
+/**
+ * Renders the AVSubtitle and sets the bitmap data for each AVSubtitleRect
+ * @param context
+ * @param sub
+ */
 void render_avsub_ass(ASS_Context *context, AVSubtitle *sub)
 {
     for (int r = 0; r < sub->num_rects; r++)
@@ -180,6 +223,7 @@ void render_avsub_ass(ASS_Context *context, AVSubtitle *sub)
     }
 }
 
+/*
 static void print_ass_image(const ASS_Image *image)
 {
     int index = 0;
@@ -234,3 +278,4 @@ static void print_subtitle(AVSubtitle sub)
     }
     printf("\n");
 }
+*/
\ No newline at end of file
diff --git a/libavcodec/text_to_bitmap.h b/libavcodec/text_to_bitmap.h
index 0c4689b039..29037150c2 100644
--- a/libavcodec/text_to_bitmap.h
+++ b/libavcodec/text_to_bitmap.h
@@ -1,9 +1,28 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
 /**
+ * @file
  * text_to_bitmap header file
  */
 
-#ifndef FFMPEG_TEXT_TO_BITMAP_H
-#define FFMPEG_TEXT_TO_BITMAP_H
+#ifndef AVCODEC_TEXT_TO_BITMAP_H
+#define AVCODEC_TEXT_TO_BITMAP_H
 
 #include <ass/ass.h>
 #include "fftools/ffmpeg.h"
@@ -21,4 +40,4 @@ void init_ass_context(
 void render_avsub_ass(ASS_Context *, AVSubtitle *);
 void free_ass_context(ASS_Context *context);
 
-#endif //FFMPEG_TEXT_TO_BITMAP_H
+#endif //AVCODEC_TEXT_TO_BITMAP_H
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 09/12] Rearranged files, all tests are passing!
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
                   ` (7 preceding siblings ...)
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 08/12] Added standard headers Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 10/12] " Traian Coza
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 {libavcodec => fftools}/text_to_bitmap.c | 0
 {libavcodec => fftools}/text_to_bitmap.h | 0
 2 files changed, 0 insertions(+), 0 deletions(-)
 rename {libavcodec => fftools}/text_to_bitmap.c (100%)
 rename {libavcodec => fftools}/text_to_bitmap.h (100%)

diff --git a/libavcodec/text_to_bitmap.c b/fftools/text_to_bitmap.c
similarity index 100%
rename from libavcodec/text_to_bitmap.c
rename to fftools/text_to_bitmap.c
diff --git a/libavcodec/text_to_bitmap.h b/fftools/text_to_bitmap.h
similarity index 100%
rename from libavcodec/text_to_bitmap.h
rename to fftools/text_to_bitmap.h
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 10/12] Rearranged files, all tests are passing!
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
                   ` (8 preceding siblings ...)
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 09/12] Rearranged files, all tests are passing! Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 11/12] Added logging Traian Coza
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 fftools/Makefile         |  2 ++
 fftools/ffmpeg.c         |  6 ++++--
 fftools/text_to_bitmap.c | 14 +++-----------
 fftools/text_to_bitmap.h | 14 ++++----------
 libavcodec/Makefile      |  1 -
 libavcodec/avcodec.c     |  9 ---------
 6 files changed, 13 insertions(+), 33 deletions(-)

diff --git a/fftools/Makefile b/fftools/Makefile
index 81ad6c4f4f..f9334a5622 100644
--- a/fftools/Makefile
+++ b/fftools/Makefile
@@ -15,6 +15,8 @@ OBJS-ffmpeg +=                  \
     fftools/ffmpeg_mux.o        \
     fftools/ffmpeg_opt.o        \
 
+OBJS-ffmpeg-$(CONFIG_LIBASS) += fftools/text_to_bitmap.o
+
 define DOFFTOOL
 OBJS-$(1) += fftools/cmdutils.o fftools/opt_common.o fftools/$(1).o $(OBJS-$(1)-yes)
 $(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1))
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index ae622492ee..251a3ce427 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -72,7 +72,7 @@
 # include "libavfilter/buffersink.h"
 
 #if CONFIG_LIBASS
-#include "libavcodec/text_to_bitmap.h"
+#include "fftools/text_to_bitmap.h"
 #endif
 
 #if HAVE_SYS_RESOURCE_H
@@ -3239,7 +3239,7 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame,
                 return AVERROR_INVALIDDATA;
             }
             if (input_props == AV_CODEC_PROP_TEXT_SUB && output_props == AV_CODEC_PROP_BITMAP_SUB)
-                init_ass_context(input_streams, output_streams, nb_input_streams, nb_output_streams, ost->source_index, ost->index);
+                init_ass_context(ist, ost);
 #else
             if (input_props && output_props && input_props != output_props) {
                 snprintf(error, error_len,
@@ -4514,6 +4514,8 @@ static int transcode(void)
         ist = input_streams[i];
         if (ist->decoding_needed) {
             avcodec_close(ist->dec_ctx);
+            if (ist->dec_ctx->ass_context != NULL)     // This really has to be done here, sorry
+                free_ass_context(ist->dec_ctx->ass_context);
             if (ist->hwaccel_uninit)
                 ist->hwaccel_uninit(ist->dec_ctx);
         }
diff --git a/fftools/text_to_bitmap.c b/fftools/text_to_bitmap.c
index 52d161d7b1..b4a0157174 100644
--- a/fftools/text_to_bitmap.c
+++ b/fftools/text_to_bitmap.c
@@ -27,8 +27,8 @@
 #include "text_to_bitmap.h"
 
 #include "fftools/ffmpeg.h"
-#include "avcodec.h"
-#include "ass_split.h"
+#include "../libavcodec/avcodec.h"
+#include "../libavcodec/ass_split.h"
 
 /**
  * Holds the objects used by the rendering function so they don't have to be reinitialized every time
@@ -51,16 +51,8 @@ struct ASS_Context {
  * @param ist_i index of input stream for transcoding
  * @param ost_i index of output stream for transcoding
  */
-void init_ass_context(
-        InputStream **input_streams,
-        OutputStream **output_streams,
-        int nb_input_streams,
-        int nb_output_streams,
-        int ist_i,
-        int ost_i)
+void init_ass_context(InputStream *ist, OutputStream *ost)
 {
-    InputStream *ist = input_streams[ist_i];
-    OutputStream *ost = output_streams[ost_i];
     if (ist->dec_ctx->ass_context) return;
 
     ASS_Context *context = (ASS_Context *)malloc(sizeof(ASS_Context));
diff --git a/fftools/text_to_bitmap.h b/fftools/text_to_bitmap.h
index 29037150c2..a9b48c6cf3 100644
--- a/fftools/text_to_bitmap.h
+++ b/fftools/text_to_bitmap.h
@@ -21,8 +21,8 @@
  * text_to_bitmap header file
  */
 
-#ifndef AVCODEC_TEXT_TO_BITMAP_H
-#define AVCODEC_TEXT_TO_BITMAP_H
+#ifndef FFTOOLS_TEXT_TO_BITMAP_H
+#define FFTOOLS_TEXT_TO_BITMAP_H
 
 #include <ass/ass.h>
 #include "fftools/ffmpeg.h"
@@ -30,14 +30,8 @@
 struct ASS_Context;
 typedef struct ASS_Context ASS_Context;
 
-void init_ass_context(
-        InputStream **input_streams,
-        OutputStream **output_streams,
-        int nb_input_streams,
-        int nb_output_streams,
-        int ist_i,
-        int ost_i);
+void init_ass_context(InputStream *ist, OutputStream *ost);
 void render_avsub_ass(ASS_Context *, AVSubtitle *);
 void free_ass_context(ASS_Context *context);
 
-#endif //AVCODEC_TEXT_TO_BITMAP_H
+#endif //FFTOOLS_TEXT_TO_BITMAP_H
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6d28513129..cfaa6f196a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -151,7 +151,6 @@ OBJS-$(CONFIG_RV34DSP)                 += rv34dsp.o
 OBJS-$(CONFIG_SINEWIN)                 += sinewin.o
 OBJS-$(CONFIG_SNAPPY)                  += snappy.o
 OBJS-$(CONFIG_STARTCODE)               += startcode.o
-OBJS-$(CONFIG_LIBASS)                  += text_to_bitmap.o
 OBJS-$(CONFIG_TEXTUREDSP)              += texturedsp.o
 OBJS-$(CONFIG_TEXTUREDSPENC)           += texturedspenc.o
 OBJS-$(CONFIG_TPELDSP)                 += tpeldsp.o
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 1e308f39c2..d11f035481 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -42,10 +42,6 @@
 #include "thread.h"
 #include "version.h"
 
-#if CONFIG_LIBASS
-#include "libavcodec/text_to_bitmap.h"
-#endif
-
 #include "libavutil/ffversion.h"
 const char av_codec_ffversion[] = "FFmpeg version " FFMPEG_VERSION;
 
@@ -538,11 +534,6 @@ av_cold int avcodec_close(AVCodecContext *avctx)
     } else if (av_codec_is_decoder(avctx->codec))
         av_freep(&avctx->subtitle_header);
 
-#if CONFIG_LIBASS
-    if (av_codec_is_decoder(avctx->codec) && avctx->ass_context != NULL)
-        free_ass_context(avctx->ass_context);
-#endif
-
     avctx->codec = NULL;
     avctx->active_thread_type = 0;
 
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 11/12] Added logging
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
                   ` (9 preceding siblings ...)
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 10/12] " Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 12/12] Added more logging Traian Coza
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 fftools/ffmpeg.c         |  4 +++-
 fftools/text_to_bitmap.c | 27 ++++++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 251a3ce427..b4d3d491de 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -3244,7 +3244,7 @@ static int init_output_stream(OutputStream *ost, AVFrame *frame,
             if (input_props && output_props && input_props != output_props) {
                 snprintf(error, error_len,
                          "Subtitle encoding currently only possible from text to text "
-                         "or bitmap to bitmap");
+                         "or bitmap to bitmap (configure with --enable-libass for text to bitmap support)");
                 return AVERROR_INVALIDDATA;
             }
 #endif
@@ -4514,8 +4514,10 @@ static int transcode(void)
         ist = input_streams[i];
         if (ist->decoding_needed) {
             avcodec_close(ist->dec_ctx);
+#if CONFIG_LIBASS
             if (ist->dec_ctx->ass_context != NULL)     // This really has to be done here, sorry
                 free_ass_context(ist->dec_ctx->ass_context);
+#endif
             if (ist->hwaccel_uninit)
                 ist->hwaccel_uninit(ist->dec_ctx);
         }
diff --git a/fftools/text_to_bitmap.c b/fftools/text_to_bitmap.c
index b4a0157174..0f165e7722 100644
--- a/fftools/text_to_bitmap.c
+++ b/fftools/text_to_bitmap.c
@@ -40,6 +40,30 @@ struct ASS_Context {
     ASSSplitContext *ass_split_context;
 };
 
+// Copied from vf_subtitles.c
+/* libass supports a log level ranging from 0 to 7 */
+static const int ass_libavfilter_log_level_map[] = {
+        [0] = AV_LOG_FATAL,     /* MSGL_FATAL */
+        [1] = AV_LOG_ERROR,     /* MSGL_ERR */
+        [2] = AV_LOG_WARNING,   /* MSGL_WARN */
+        [3] = AV_LOG_WARNING,   /* <undefined> */
+        [4] = AV_LOG_INFO,      /* MSGL_INFO */
+        [5] = AV_LOG_INFO,      /* <undefined> */
+        [6] = AV_LOG_VERBOSE,   /* MSGL_V */
+        [7] = AV_LOG_DEBUG,     /* MSGL_DBG2 */
+};
+
+// Also copied
+static void ass_log(int ass_level, const char *fmt, va_list args, void *ctx)
+{
+    const int ass_level_clip = av_clip(ass_level, 0,
+        FF_ARRAY_ELEMS(ass_libavfilter_log_level_map) - 1);
+    const int level = ass_libavfilter_log_level_map[ass_level_clip];
+
+    av_vlog(NULL, level, fmt, args);
+    av_log(NULL, level, "\n");
+}
+
 /**
  * Initiates the ASS_Context structure and adds it to the input stream decoder context.
  * Does nothing if ist->dec_ctx->ass_context is already set.
@@ -57,6 +81,7 @@ void init_ass_context(InputStream *ist, OutputStream *ost)
 
     ASS_Context *context = (ASS_Context *)malloc(sizeof(ASS_Context));
     context->library = ass_library_init();
+    ass_set_message_cb(context->library, ass_log, NULL);
     ass_set_extract_fonts(context->library, 1);
     // TODO: ass_add_font(context->library, ...);
 
@@ -172,7 +197,7 @@ void render_avsub_ass(ASS_Context *context, AVSubtitle *sub)
 
         ASS_Image *image = ass_render_frame(context->renderer, track,
             track->events[0].Start + track->events[0].Duration / 2, NULL);
-        if (image == NULL) printf("WARNING: failed to render ass\n");
+        if (image == NULL) av_log(NULL, AV_LOG_WARNING, "failed to render ass\n");
 
         rect->x = image ? image->dst_x : 0; rect->w = 0;
         rect->y = image ? image->dst_y : 0; rect->h = 0;
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [FFmpeg-devel] [PATCH 12/12] Added more logging
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
                   ` (10 preceding siblings ...)
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 11/12] Added logging Traian Coza
@ 2022-05-03 16:13 ` Traian Coza
  2022-05-03 16:20 ` [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Paul B Mahol
  2022-05-03 16:27 ` Soft Works
  13 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 16:13 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Traian Coza

---
 fftools/text_to_bitmap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fftools/text_to_bitmap.c b/fftools/text_to_bitmap.c
index 0f165e7722..e05e485713 100644
--- a/fftools/text_to_bitmap.c
+++ b/fftools/text_to_bitmap.c
@@ -122,7 +122,8 @@ void init_ass_context(InputStream *ist, OutputStream *ost)
             }
         if (width && height) break;
 
-        // TODO Error: Cannot render without a width and height
+        av_log(NULL, AV_LOG_ERROR, "Cannot render text subtitle without frame size\n");
+        return;
     } while (0);
 
     context->renderer = ass_renderer_init(context->library);
@@ -197,7 +198,8 @@ void render_avsub_ass(ASS_Context *context, AVSubtitle *sub)
 
         ASS_Image *image = ass_render_frame(context->renderer, track,
             track->events[0].Start + track->events[0].Duration / 2, NULL);
-        if (image == NULL) av_log(NULL, AV_LOG_WARNING, "failed to render ass\n");
+        if (image == NULL) av_log(NULL, AV_LOG_WARNING,
+            "failed to render ass: %s\n", rect->ass);
 
         rect->x = image ? image->dst_x : 0; rect->w = 0;
         rect->y = image ? image->dst_y : 0; rect->h = 0;
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality!
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
                   ` (11 preceding siblings ...)
  2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 12/12] Added more logging Traian Coza
@ 2022-05-03 16:20 ` Paul B Mahol
  2022-05-03 16:51   ` Nicolas George
  2022-05-03 16:27 ` Soft Works
  13 siblings, 1 reply; 20+ messages in thread
From: Paul B Mahol @ 2022-05-03 16:20 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Traian Coza

On Tue, May 3, 2022 at 6:13 PM Traian Coza <traian.coza@gmail.com> wrote:

> I added the possibility of converting text-based subtitle tracks (such as
> subrip or ass) to bitmap-based subtitle tracks (such as dvd_subtitle).
>
> I accomplished this by using libass, and basically using the code from
> vf_subtitles.c to render text subtitles and store the images in the
> AVSubtitle structure.
>
> Of course, this functionality will only work when ffmpeg is configured
> with --enable-libass.
>
>
Sorry but i think this needs to be in libavfilter instead of libavcodec.

And for libavfilter one needs to add proper, not hacky, subtitle support to
library.



> Traian Coza (12):
>   Implemented text to bitmap subtitles!
>   Render only when necessary
>   Retreive width and height from video stream!
>   Initialize ass library only once!
>   Cleaned up
>   Wrote proper headers
>   Close libass after using
>   Added standard headers
>   Rearranged files, all tests are passing!
>   Rearranged files, all tests are passing!
>   Added logging
>   Added more logging
>
>  fftools/Makefile         |   2 +
>  fftools/ffmpeg.c         |  35 ++++-
>  fftools/text_to_bitmap.c | 300 +++++++++++++++++++++++++++++++++++++++
>  fftools/text_to_bitmap.h |  37 +++++
>  libavcodec/avcodec.h     |   9 ++
>  5 files changed, 382 insertions(+), 1 deletion(-)
>  create mode 100644 fftools/text_to_bitmap.c
>  create mode 100644 fftools/text_to_bitmap.h
>
> --
> 2.34.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality!
  2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
                   ` (12 preceding siblings ...)
  2022-05-03 16:20 ` [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Paul B Mahol
@ 2022-05-03 16:27 ` Soft Works
  2022-05-04  0:16   ` Soft Works
  13 siblings, 1 reply; 20+ messages in thread
From: Soft Works @ 2022-05-03 16:27 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Traian Coza



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Traian Coza
> Sent: Tuesday, May 3, 2022 6:13 PM
> To: ffmpeg-devel@ffmpeg.org
> Cc: Traian Coza <traian.coza@gmail.com>
> Subject: [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle
> conversion functionality!
> 
> I added the possibility of converting text-based subtitle tracks (such
> as subrip or ass) to bitmap-based subtitle tracks (such as
> dvd_subtitle).
> 
> I accomplished this by using libass, and basically using the code from
> vf_subtitles.c to render text subtitles and store the images in the
> AVSubtitle structure.

Have you seen this: https://github.com/ffstaging/FFmpeg/pull/18

sw
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality!
  2022-05-03 16:20 ` [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Paul B Mahol
@ 2022-05-03 16:51   ` Nicolas George
  2022-05-03 17:01     ` Traian Coza
  0 siblings, 1 reply; 20+ messages in thread
From: Nicolas George @ 2022-05-03 16:51 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 427 bytes --]

Paul B Mahol (12022-05-03):
> Sorry but i think this needs to be in libavfilter instead of libavcodec.
> 
> And for libavfilter one needs to add proper, not hacky, subtitle support to
> library.

I completely agree.

Also, the patches neglect a lot of the directives in the developer
documentation, from having self-contained clean commits to the wording
of the commit messages.

Regards,

-- 
  Nicolas George

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality!
  2022-05-03 16:51   ` Nicolas George
@ 2022-05-03 17:01     ` Traian Coza
  2022-05-03 17:05       ` Leo Izen
  0 siblings, 1 reply; 20+ messages in thread
From: Traian Coza @ 2022-05-03 17:01 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

I already made the commits, tho, what do you suggest I do? Should I modify
the messages?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality!
  2022-05-03 17:01     ` Traian Coza
@ 2022-05-03 17:05       ` Leo Izen
  2022-05-03 17:09         ` Traian Coza
  0 siblings, 1 reply; 20+ messages in thread
From: Leo Izen @ 2022-05-03 17:05 UTC (permalink / raw)
  To: ffmpeg-devel

On 5/3/22 13:01, Traian Coza wrote:
> I already made the commits, tho, what do you suggest I do? Should I modify
> the messages?
> _______________________________________________

You'll have to send another patchset. You append -v2 to your "git 
format-patch" command-line to generate a second version of the patch set.

Speaking of which, please read 
https://ffmpeg.org/developer.html#Contributing since it appears you have 
not. For example, you need to rebase your branch before submitting so 
the commits are squashed as necessary. Read up on "git rebase -i" or 
interactive rebase with git.

Leo Izen (thebombzen)


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality!
  2022-05-03 17:05       ` Leo Izen
@ 2022-05-03 17:09         ` Traian Coza
  0 siblings, 0 replies; 20+ messages in thread
From: Traian Coza @ 2022-05-03 17:09 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Thanks, I'll do that. I did read a bit of Contributing, but not entirely.
And I read after writing the code, so there are some things I wasn't aware
of at the time of writing the code.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality!
  2022-05-03 16:27 ` Soft Works
@ 2022-05-04  0:16   ` Soft Works
  0 siblings, 0 replies; 20+ messages in thread
From: Soft Works @ 2022-05-04  0:16 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Traian Coza



> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Soft
> Works
> Sent: Tuesday, May 3, 2022 6:27 PM
> To: FFmpeg development discussions and patches <ffmpeg-
> devel@ffmpeg.org>
> Cc: Traian Coza <traian.coza@gmail.com>
> Subject: Re: [FFmpeg-devel] [PATCH 00/12] I added text to bitmap
> subtitle conversion functionality!
> 
> 
> 
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > Traian Coza
> > Sent: Tuesday, May 3, 2022 6:13 PM
> > To: ffmpeg-devel@ffmpeg.org
> > Cc: Traian Coza <traian.coza@gmail.com>
> > Subject: [FFmpeg-devel] [PATCH 00/12] I added text to bitmap
> subtitle
> > conversion functionality!
> >
> > I added the possibility of converting text-based subtitle tracks
> (such
> > as subrip or ass) to bitmap-based subtitle tracks (such as
> > dvd_subtitle).
> >
> > I accomplished this by using libass, and basically using the code
> from
> > vf_subtitles.c to render text subtitles and store the images in the
> > AVSubtitle structure.
> 
> Have you seen this: https://github.com/ffstaging/FFmpeg/pull/18

With the subtitle filtering patchset, you could do the same with 
a fraction of code and (probably) a single code file.

You can use the textsub2video filter as a starting point to
create a textsub2graphicsub filter.

What you see there will look all familiar to you. The textsub2video
filter uses libass as well.
You'll need to change the output media type to subtitle and the
format to graphic subtitles and add AvSubtitleArea items for 
each bitmap in a frame (similar to AVSubtitleRect).

Your code will magically shrink.. :-)

Kind regards,
softworkz







_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-05-04  0:16 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 16:13 [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 01/12] Implemented text to bitmap subtitles! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 02/12] Render only when necessary Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 03/12] Retreive width and height from video stream! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 04/12] Initialize ass library only once! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 05/12] Cleaned up Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 06/12] Wrote proper headers Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 07/12] Close libass after using Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 08/12] Added standard headers Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 09/12] Rearranged files, all tests are passing! Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 10/12] " Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 11/12] Added logging Traian Coza
2022-05-03 16:13 ` [FFmpeg-devel] [PATCH 12/12] Added more logging Traian Coza
2022-05-03 16:20 ` [FFmpeg-devel] [PATCH 00/12] I added text to bitmap subtitle conversion functionality! Paul B Mahol
2022-05-03 16:51   ` Nicolas George
2022-05-03 17:01     ` Traian Coza
2022-05-03 17:05       ` Leo Izen
2022-05-03 17:09         ` Traian Coza
2022-05-03 16:27 ` Soft Works
2022-05-04  0:16   ` Soft Works

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git