mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2024-12-24 11:53:25 +00:00
mp4 support
This commit is contained in:
parent
9d8bb65e2a
commit
7be2d231a8
@ -9,6 +9,9 @@ version of CCExtractor.
|
||||
- Added DVB subtitles decoder, spupng in output
|
||||
- Added support for cdt2 media atoms in QT video files. Now multiple atoms in
|
||||
a single sample sequence are supported.
|
||||
- Changed Makefile.
|
||||
- Fixed some bugs.
|
||||
- Added feature to print info about file's subtitles and streams.
|
||||
|
||||
0.69
|
||||
----
|
||||
|
@ -3,7 +3,7 @@ SHELL = /bin/sh
|
||||
CC = gcc
|
||||
CXX = g++
|
||||
|
||||
CFLAGS = -g -Wall -std=gnu99
|
||||
CFLAGS = -O3 -std=gnu99
|
||||
INCLUDE = -I../src/gpacmp4/ -I../src/libpng -I../src/zlib
|
||||
ALL_FLAGS = -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64
|
||||
LDFLAGS = -lm -zmuldefs
|
||||
@ -40,6 +40,7 @@ CFLAGS+=-I/usr/local/include/tesseract -I/usr/local/include/leptonica
|
||||
CFLAGS+=-DENABLE_OCR
|
||||
LDFLAGS+= $(shell pkg-config --libs tesseract)
|
||||
endif
|
||||
|
||||
.PHONY: all
|
||||
all: objs_dir $(TARGET)
|
||||
|
||||
|
@ -174,6 +174,7 @@ struct file_report_t
|
||||
unsigned services708[63];
|
||||
unsigned dvb_sub_pid[SUB_STREAMS_CNT];
|
||||
unsigned tlt_sub_pid[SUB_STREAMS_CNT];
|
||||
unsigned mp4_cc_track_cnt;
|
||||
} file_report;
|
||||
|
||||
|
||||
|
@ -125,7 +125,11 @@ int switch_to_next_file (LLONG bytesinbuffer)
|
||||
if (ccx_options.input_source==CCX_DS_STDIN)
|
||||
{
|
||||
if (infd!=-1) // Means we had already processed stdin. So we're done.
|
||||
{
|
||||
if (ccx_options.print_file_reports)
|
||||
print_file_report();
|
||||
return 0;
|
||||
}
|
||||
infd=0;
|
||||
mprint ("\n\r-----------------------------------------------------------------\n");
|
||||
mprint ("\rReading from standard input\n");
|
||||
@ -134,7 +138,12 @@ int switch_to_next_file (LLONG bytesinbuffer)
|
||||
if (ccx_options.input_source==CCX_DS_NETWORK)
|
||||
{
|
||||
if (infd!=-1) // Means we have already bound a socket.
|
||||
{
|
||||
if (ccx_options.print_file_reports)
|
||||
print_file_report();
|
||||
|
||||
return 0;
|
||||
}
|
||||
if (init_sockets())
|
||||
return 1;
|
||||
infd=socket(AF_INET,SOCK_DGRAM,0);
|
||||
@ -179,7 +188,6 @@ int switch_to_next_file (LLONG bytesinbuffer)
|
||||
{
|
||||
if (ccx_options.print_file_reports)
|
||||
print_file_report();
|
||||
|
||||
close_input_file ();
|
||||
if (inputsize>0 && ((past+bytesinbuffer) < inputsize) && !processed_enough)
|
||||
{
|
||||
|
@ -74,6 +74,7 @@ static int process_avc_sample(u32 timescale, GF_AVCConfig* c, GF_ISOSample* s)
|
||||
static int process_xdvb_track(const char* basename, GF_ISOFile* f, u32 track)
|
||||
{
|
||||
u32 timescale, i, sample_count, last_sdi = 0;
|
||||
|
||||
int status;
|
||||
if((sample_count = gf_isom_get_sample_count(f, track)) < 1){
|
||||
return 0;
|
||||
@ -340,7 +341,7 @@ int processmp4 (char *file)
|
||||
f = NULL;
|
||||
mprint ("ok\n");
|
||||
|
||||
if(avc_track_count == 0){
|
||||
if(avc_track_count == 0){
|
||||
mprint("Found no AVC track(s). ", file);
|
||||
}else{
|
||||
mprint("Found %d AVC track(s). ", avc_track_count);
|
||||
@ -350,5 +351,9 @@ int processmp4 (char *file)
|
||||
else
|
||||
mprint ("found no dedicated CC track(s).\n");
|
||||
|
||||
file_report.mp4_cc_track_cnt = cc_track_count;
|
||||
if (ccx_options.print_file_reports)
|
||||
print_file_report();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -274,9 +274,10 @@ void set_output_format (const char *format)
|
||||
}
|
||||
else if (strcmp (format,"report")==0)
|
||||
{
|
||||
ccx_options.write_format=CCX_OF_NULL;
|
||||
ccx_options.write_format=CCX_OF_NULL;
|
||||
ccx_options.messages_target=0;
|
||||
ccx_options.print_file_reports=1;
|
||||
ccx_options.print_file_reports=1;
|
||||
ccx_options.ts_autoprogram=1;
|
||||
}
|
||||
else if (strcmp (format,"raw")==0)
|
||||
ccx_options.write_format=CCX_OF_RAW;
|
||||
@ -406,8 +407,8 @@ void usage (void)
|
||||
mprint (" dvdauthor's spumux.\n");
|
||||
mprint (" See \"Notes on spupng output format\"\n");
|
||||
mprint (" null -> Don't produce any file output\n");
|
||||
mprint (" report -> Prints to stdout information about captions");
|
||||
mprint (" in specified input. Don't produce any file");
|
||||
mprint (" report -> Prints to stdout information about captions\n");
|
||||
mprint (" in specified input. Don't produce any file\n");
|
||||
mprint (" output\n\n");
|
||||
mprint (" Note: Teletext output can only be srt, txt or ttxt for now.\n\n");
|
||||
|
||||
|
@ -219,15 +219,15 @@ void print_file_report(void)
|
||||
break;
|
||||
}
|
||||
|
||||
printf("StreamMode: ");
|
||||
printf("Stream Mode: ");
|
||||
switch (stream_mode)
|
||||
{
|
||||
case CCX_SM_TRANSPORT:
|
||||
printf("transport_stream\n");
|
||||
printf("Transport Stream\n");
|
||||
|
||||
printf("ProgramCount: %d\n", file_report.program_cnt);
|
||||
printf("Program Count: %d\n", file_report.program_cnt);
|
||||
|
||||
printf("ProgramNumbers: ");
|
||||
printf("Program Numbers: ");
|
||||
for (int i = 0; i < pmt_array_length; i++)
|
||||
{
|
||||
if (pmt_array[i].program_number == 0)
|
||||
@ -263,7 +263,7 @@ void print_file_report(void)
|
||||
|
||||
break;
|
||||
case CCX_SM_PROGRAM:
|
||||
printf("program_stream\n");
|
||||
printf("Program Stream\n");
|
||||
break;
|
||||
case CCX_SM_ASF:
|
||||
printf("ASF\n");
|
||||
@ -272,22 +272,40 @@ void print_file_report(void)
|
||||
printf("WTV\n");
|
||||
break;
|
||||
case CCX_SM_ELEMENTARY_OR_NOT_FOUND:
|
||||
printf("not_found\n");
|
||||
printf("Not Found\n");
|
||||
break;
|
||||
case CCX_SM_MP4:
|
||||
printf("MP4\n");
|
||||
break;
|
||||
case CCX_SM_MCPOODLESRAW:
|
||||
printf("McPoodle's raw\n");
|
||||
break;
|
||||
case CCX_SM_RCWT:
|
||||
printf("BIN\n");
|
||||
break;
|
||||
case CCX_SM_HEX_DUMP:
|
||||
printf("Hex\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (ccx_bufferdatatype == CCX_PES)
|
||||
if (ccx_bufferdatatype == CCX_PES &&
|
||||
(stream_mode == CCX_SM_TRANSPORT ||
|
||||
stream_mode == CCX_SM_PROGRAM ||
|
||||
stream_mode == CCX_SM_ASF ||
|
||||
stream_mode == CCX_SM_WTV))
|
||||
{
|
||||
printf("Width: %u\n", file_report.width);
|
||||
printf("Height: %u\n", file_report.height);
|
||||
printf("AspectRatio: %s\n", aspect_ratio_types[file_report.aspect_ratio]);
|
||||
printf("FrameRate: %s\n", framerates_types[file_report.frame_rate]);
|
||||
printf("Aspect Ratio: %s\n", aspect_ratio_types[file_report.aspect_ratio]);
|
||||
printf("Frame Rate: %s\n", framerates_types[file_report.frame_rate]);
|
||||
}
|
||||
|
||||
if (file_report.program_cnt > 1)
|
||||
printf("//////// Program #%u: ////////\n", TS_program_number);
|
||||
|
||||
printf("DVB-Subtitles: ");
|
||||
printf("DVB Subtitles: ");
|
||||
int j;
|
||||
for (j = 0; j < SUB_STREAMS_CNT; j++)
|
||||
{
|
||||
@ -313,7 +331,7 @@ void print_file_report(void)
|
||||
{
|
||||
printf("Yes\n");
|
||||
|
||||
printf("PagesWithSubtitles: ");
|
||||
printf("Pages With Subtitles: ");
|
||||
for (int i = 0; i < MAX_TLT_PAGES; i++)
|
||||
{
|
||||
if (seen_sub_page[i] == 0)
|
||||
@ -332,7 +350,7 @@ void print_file_report(void)
|
||||
|
||||
if (cc_stats[0] > 0 || cc_stats[1] > 0)
|
||||
{
|
||||
printf("XDSPresent: %s\n", Y_N(file_report.xds));
|
||||
printf("XDS: %s\n", Y_N(file_report.xds));
|
||||
|
||||
printf("CC1: %s\n", Y_N(file_report.cc_channels_608[0]));
|
||||
printf("CC2: %s\n", Y_N(file_report.cc_channels_608[1]));
|
||||
@ -353,9 +371,14 @@ void print_file_report(void)
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
printf("PrimaryLanguagePresent: %s\n", Y_N(file_report.services708[1]));
|
||||
printf("Primary Language Present: %s\n", Y_N(file_report.services708[1]));
|
||||
|
||||
printf("SecondaryLanguagePresent: %s\n", Y_N(file_report.services708[2]));
|
||||
printf("Secondary Language Present: %s\n", Y_N(file_report.services708[2]));
|
||||
}
|
||||
|
||||
printf("MPEG-4 Timed Text: %s\n", Y_N(file_report.mp4_cc_track_cnt));
|
||||
if (file_report.mp4_cc_track_cnt) {
|
||||
printf("MPEG-4 Timed Text tracks count: %d\n", file_report.mp4_cc_track_cnt);
|
||||
}
|
||||
|
||||
memset(&file_report, 0, sizeof (struct file_report_t));
|
||||
|
@ -103,7 +103,8 @@ void detect_stream_type (void)
|
||||
stream_mode=CCX_SM_ELEMENTARY_OR_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
if (stream_mode==CCX_SM_ELEMENTARY_OR_NOT_FOUND && startbytes_avail>=4) // Still not found
|
||||
if ((stream_mode==CCX_SM_ELEMENTARY_OR_NOT_FOUND || ccx_options.print_file_reports)
|
||||
&& startbytes_avail>=4) // Still not found
|
||||
{
|
||||
// Try for MP4 by looking for box signatures - this should happen very
|
||||
// early in the file according to specs
|
||||
|
Loading…
Reference in New Issue
Block a user