Репозитории ALT
S: | 1.1.7-alt16 |
D: | 1.0.4-alt0.1 |
5.1: | 1.0.7-alt4.1 |
4.1: | 1.0.5-alt1 |
4.0: | 1.0.2-alt3.3M40.1 |
3.0: | 0.6.14-alt1.3 |
+backports: | 1.0.2-alt2.M30.2 |
Группа :: Видео
Пакет: transcode
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: transcode-1.0.2-dirac-0.5.x.patch
Скачать
Скачать
diff -urN transcode-1.0.2.orig/docs/README.dirac transcode-1.0.2/docs/README.dirac
--- transcode-1.0.2.orig/docs/README.dirac 1970-01-01 03:00:00 +0300
+++ transcode-1.0.2/docs/README.dirac 2006-09-20 17:07:07 +0300
@@ -0,0 +1,26 @@
+**Dirac support for transcode via ffmpeg
+**Tested with transcode version 1.0.0 and ffmpeg version 0.4.19-pre1 and
+**ffmpeg cvs version dated 06-Aug-2005
+**Author: dirac_dev@users.sourceforge.net
+
+This patch allows the Dirac codec to be invoked by transcode via ffmpeg.
+Dirac is an open-source video codec currently under developement. Both the
+encoder and decoder have been integrated with ffmpeg.
+
+Sample Usage:
+raw avi input - avi output (will write Dirac encoded data to .avi format)
+transcode -i input.avi -x raw -i raw_input.avi -y ffmpeg -F dirac,null -o dirac_output.avi
+
+mpeg4 avi input - drc output (will write Dirac encoded data to .drc format)
+transcode mpeg_input.avi -y ffmpeg -F dirac-raw,null -o dirac_output.drc
+
+transcode -i ~/dirac_test_data/squirrel/squirrel-720x576x50_420.yuv -g 720x576 -xraw,null -y ffmpeg,null -F dirac-raw -k -o tmp.drc
+
+Both .drc and .avi encoded files can be played back in MPlayer (with the
+correct Dirac patch)
+
+Files Changed:
+export_ffmpeg.c
+A 'raw_output' boolean has been added in to enable both .avi and .drc output
+for Dirac. In MOD_close, added ability to retrieve delayed frames in encoder
+at EOF.
diff -urN transcode-1.0.2.orig/export/export_ffmpeg.c transcode-1.0.2/export/export_ffmpeg.c
--- transcode-1.0.2.orig/export/export_ffmpeg.c 2005-07-12 10:01:16 +0300
+++ transcode-1.0.2/export/export_ffmpeg.c 2006-09-20 17:07:46 +0300
@@ -136,6 +136,7 @@
{"ffv1", "FFV1", "FF Video Codec 1 (an experimental lossless codec)", 0},
{"asv1", "ASV1", "ASUS V1 codec", 0},
{"asv2", "ASV2", "ASUS V2 codec", 0},
+ {"dirac", "drac", "Dirac codec", 0},
{NULL, NULL, NULL, 0}
};
@@ -179,8 +180,9 @@
static struct ffmpeg_codec *codec;
static int is_mpegvideo = 0;
static int is_huffyuv = 0;
+static int raw_output = 0;
static int is_mjpeg = 0;
-static FILE *mpeg1fd = NULL;
+static FILE *rawfd = NULL;
static int interlacing_active = 0;
static int interlacing_top_first = 0;
@@ -375,6 +377,7 @@
return TC_EXPORT_ERROR;
}
+ raw_output=0;
if (!strcmp(user_codec_string, "mpeg1"))
real_codec = strdup("mpeg1video");
else
@@ -384,7 +387,13 @@
if (!strcmp(user_codec_string, "dv"))
real_codec = strdup("dvvideo");
else
- real_codec = strdup(user_codec_string);
+ if(!strcmp(user_codec_string, "dirac-raw"))
+ {
+ raw_output=1;
+ real_codec = strdup("dirac");
+ video_ext = strdup(".drc");
+ }
+ else real_codec = strdup(user_codec_string);
if (!strcmp(user_codec_string, "huffyuv"))
is_huffyuv = 1;
@@ -439,11 +448,15 @@
} else
pseudo_codec = pc_none;
- if (!strcmp(real_codec, "mpeg1video"))
+ if (!strcmp(real_codec, "mpeg1video")) {
+ raw_output = 1;
is_mpegvideo = 1;
+ }
- if (!strcmp(real_codec, "mpeg2video"))
+ if (!strcmp(real_codec, "mpeg2video")) {
+ raw_output = 1;
is_mpegvideo = 2;
+ }
codec = find_ffmpeg_codec(real_codec);
@@ -1482,7 +1495,7 @@
// open output file
/* Open file */
- if ( (param->flag == TC_VIDEO && !is_mpegvideo) || (param->flag == TC_AUDIO && !vob->out_flag)) {
+ if ( (param->flag == TC_VIDEO && !raw_output) || (param->flag == TC_AUDIO && !vob->out_flag)) {
if (vob->avifile_out==NULL) {
vob->avifile_out = AVI_open_output_file(vob->video_out_file);
@@ -1504,9 +1517,9 @@
char * buf = 0;
const char * ext;
// video
- if (is_mpegvideo) {
+ if (raw_output) {
- if(probe_export_attributes & TC_PROBE_NO_EXPORT_VEXT)
+ if(!is_mpegvideo || probe_export_attributes & TC_PROBE_NO_EXPORT_VEXT)
ext = video_ext;
else
ext = is_mpegvideo == 1 ? ".m1v" : ".m2v";
@@ -1516,12 +1529,12 @@
return(TC_EXPORT_ERROR);
}
snprintf(buf, strlen(vob->video_out_file) + 1 + strlen(ext), "%s%s", vob->video_out_file, ext);
- mpeg1fd = fopen(buf, "wb");
+ rawfd = fopen(buf, "wb");
- if (!mpeg1fd)
+ if (!rawfd)
{
ff_warning("Can not open file \"%s\" using /dev/null\n", buf);
- mpeg1fd = fopen("/dev/null", "wb");
+ rawfd = fopen("/dev/null", "wb");
}
free (buf);
@@ -1653,7 +1666,7 @@
//0.6.2: switch outfile on "r/R" and -J pv
//0.6.2: enforce auto-split at 2G (or user value) for normal AVI files
- if (!is_mpegvideo) {
+ if (!raw_output) {
if((uint32_t)(AVI_bytes_written(avifile)+out_size+16+8)>>20 >= tc_avi_limit) tc_outstream_rotate_request();
if (lavc_venc_context->coded_frame->key_frame) tc_outstream_rotate();
@@ -1665,7 +1678,7 @@
return TC_EXPORT_ERROR;
}
} else { // mpegvideo
- if ( (out_size >0) && (fwrite (tmp_buffer, out_size, 1, mpeg1fd) <= 0) ) {
+ if ( (out_size >0) && (fwrite (tmp_buffer, out_size, 1, rawfd) <= 0) ) {
fprintf(stderr, "[%s] encoder error write failed size (%d)\n", MOD_NAME, out_size);
//return TC_EXPORT_ERROR;
}
@@ -1785,9 +1798,28 @@
MOD_close
{
-
+ int out_size;
vob_t *vob = tc_get_vob();
+ if (param->flag == TC_AUDIO) {
+ /* get delayed data */
+ for(;;)
+ {
+ out_size = avcodec_encode_video(lavc_venc_context,
+ (unsigned char *) tmp_buffer, size,
+ NULL);
+ if(out_size < 1)
+ break;
+
+ if(raw_output)
+ fwrite (tmp_buffer, out_size, 1,rawfd);
+ else
+ AVI_write_frame(vob->avifile_out, tmp_buffer, out_size, 0);
+
+ }
+
+ }
+
if (param->flag == TC_AUDIO)
return audio_close();
@@ -1797,10 +1829,10 @@
return 0;
}
- if (is_mpegvideo) {
- if (mpeg1fd) {
- fclose (mpeg1fd);
- mpeg1fd = NULL;
+ if (raw_output) {
+ if (rawfd) {
+ fclose (rawfd);
+ rawfd = NULL;
return 0;
}
}