[Libav-user] Extract Closed caption interlaced in Userdata

anshul anshul.ffmpeg at gmail.com
Wed Mar 5 12:07:40 CET 2014


Hi

I am looking to extract Closed Caption interlaced in  userdata Frame
using libavcodec.

just now ffprobe does not say any thing about closed caption when I do 
normal ffprobe
(gdb) r -analyzeduration 100000000 -probesize 2000000000 
~/test_videos/test.ts
Starting program: /home/anshul/Software/ffmpeg/ffprobe_g 
-analyzeduration 100000000 -probesize 2000000000 ~/test_videos/test.ts
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
ffprobe version N-61086-g9477512 Copyright (c) 2007-2014 the FFmpeg 
developers
   built on Mar  5 2014 12:53:35 with gcc 4.7 (SUSE Linux)
   configuration: --enable-libfaac --enable-libx264 
--enable-memory-poisoning --enable-memalign-hack --enable-nonfree 
--enable-gpl --enable-libfreetype --disable-optimizations
   libavutil      52. 66.101 / 52. 66.101
   libavcodec     55. 52.102 / 55. 52.102
   libavformat    55. 33.101 / 55. 33.101
   libavdevice    55. 11.100 / 55. 11.100
   libavfilter     4.  2.100 /  4.  2.100
   libswscale      2.  5.101 /  2.  5.101
   libswresample   0. 18.100 /  0. 18.100
   libpostproc    52.  3.100 / 52.  3.100
Input #0, mpegts, from '/home/anshul/test_videos/test.ts':
   Duration: 00:01:42.69, start: 1.433367, bitrate: 9901 kb/s
   Program 1
     Metadata:
       service_name    : Service01
       service_provider: FFmpeg
     Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 
0x0002), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], max. 80000 kb/s, 
29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc

As I have seen that ffprobe -show_frames get into function 
mpeg_decode_a53_cc and also in mpeg_field_start
but I dont find any way to extract the AVFrameSideData in my program as 
i have copied the code snippet from mpeg_field_start
where it save a53_caption but I dont know the way to extract the caption.

1639         if (s1->a53_caption) {
1640             AVFrameSideData *sd = av_frame_new_side_data(
1641                 &s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC,
1642                 s1->a53_caption_size);
1643             if (sd)
1644                 memcpy(sd->data, s1->a53_caption, 
s1->a53_caption_size);
1645             av_freep(&s1->a53_caption);
1646         }


Thanks
Anshul Maheshwari


More information about the Libav-user mailing list