|
From: Anuradha S. <asu...@us...> - 2005-05-25 12:06:59
|
Update of /cvsroot/dirac/compress/extras/patches In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22041 Added Files: MPlayer-1.0pre7_dirac-0.5.x.patch README_MPlayer-1.0pre7_dirac-0.5.x_patch README_ffmpeg-0.4.9-pre1-dirac-0.5.x_patch README_transcode-0.6.14_dirac-0.5.x_patch ffmpeg-0.4.9-pre1-dirac-0.5.x.patch transcode-0.6.14-dirac-0.5.x.patch Log Message: Patches to MPlayer, ffmped and transcode to add Dirac support to these tools. --- NEW FILE: transcode-0.6.14-dirac-0.5.x.patch --- diff -ruN transcode-0.6.14/export/export_ffmpeg.c transcode-0.6.14-dirac/export/export_ffmpeg.c --- transcode-0.6.14/export/export_ffmpeg.c 2004-11-14 04:17:54.000000000 +0000 +++ transcode-0.6.14-dirac/export/export_ffmpeg.c 2005-05-25 11:48:46.752814314 +0100 @@ -1,3 +1,4 @@ + /* * export_ffmpeg.c * based heavily on mplayers ve_lavc.c @@ -127,6 +128,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}}; typedef enum // do not edit without changing *_name and *_rate @@ -168,8 +170,9 @@ static int frames = 0; static struct ffmpeg_codec *codec; static int is_mpegvideo = 0; +static int raw_output=0; static int is_huffyuv = 0; -static FILE *mpeg1fd = NULL; +static FILE *rawfd = NULL; static int interlacing_active = 0; static int interlacing_top_first = 0; @@ -369,6 +372,8 @@ return TC_EXPORT_ERROR; } + + raw_output=0; if(!strcmp(user_codec_string, "mpeg1")) real_codec = strdup("mpeg1video"); else @@ -378,7 +383,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; @@ -428,10 +439,16 @@ pseudo_codec = pc_none; if(!strcmp(real_codec, "mpeg1video")) + { + raw_output=1; is_mpegvideo = 1; - + } + if(!strcmp(real_codec, "mpeg2video")) + { + raw_output=1; is_mpegvideo = 2; + } codec = find_ffmpeg_codec(real_codec); @@ -1387,7 +1404,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); @@ -1409,21 +1426,21 @@ 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"; buf = malloc(strlen (vob->video_out_file)+1+strlen(ext)); sprintf(buf, "%s%s", vob->video_out_file, ext); - mpeg1fd = fopen(buf, "wb"); - - if (!mpeg1fd) + rawfd = fopen(buf, "wb"); + fprintf(stderr, "%s \n", ext); + 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); @@ -1548,22 +1565,22 @@ if (verbose & TC_STATS) { fprintf(stderr, "[%s] encoder: size of encoded (%d)\n", MOD_NAME, out_size); } - + fprintf(stderr, "[%s] size (%d)\n", MOD_NAME, out_size); //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(); - + if (AVI_write_frame(avifile, tmp_buffer, out_size, - lavc_venc_context->coded_frame->key_frame? 1 : 0) < 0) { + lavc_venc_context->coded_frame->key_frame? 1 : 1) < 0) { AVI_print_error("avi video write error"); 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; } @@ -1684,8 +1701,32 @@ MOD_close { +int out_size; + vob_t *vob = tc_get_vob(); + if (param->flag == TC_VIDEO) { + + + /* 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(); @@ -1695,10 +1736,10 @@ return 0; } - if (is_mpegvideo) { - if (mpeg1fd) { - fclose (mpeg1fd); - mpeg1fd = NULL; + if (raw_output) { + if (rawfd) { + fclose (rawfd); + rawfd = NULL; return 0; } } --- NEW FILE: README_transcode-0.6.14_dirac-0.5.x_patch --- **Dirac support for transcode via ffmpeg **Tested with transcode version 0.6.14 and ffmpeg version 0.4.19-pre1 **Author: dir...@so... 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. These are the instructions for enabling Dirac support in transcode via ffmpeg source code. 1. Download Dirac 0.5.2 from http://sourceforge.net/projects/dirac/ 2. Unpack the Dirac source tar xvzf dirac-0.5.2.tar.gz 3. Build and Install cd dirac-0.5.2 ./configure make make install The last step installs the Dirac share encoder and decoder libraries in /usr/local/lib (which is the default install point). 3. Download ffmpeg version 0.4.9-pre1 http://sourceforge.net/project/showfiles.php?group_id=16082 4. Unpack ffmpeg source tar xvzf ffmpeg-0.4.9-pre1.tar 5. Apply ffmpeg-dirac patch cd ffmpeg-0.4.9-pre1 patch -p1 < ffmpeg-0.4.9-pre1-dirac-0.5.x.patch 6. Build and Install ffmpeg ./configure --enable-dirac make make install 7. Download transcode version 0.6.14 http://www.transcoding.org/cgi-bin/transcode?Download 8. Unpack transcode source tar xvzf transcode-0.6.14.tar.gz 9. Apply transcode-dirac patch cd transcode-0.6.14 patch -p1 < transcode-0.6.14-dirac-0.5.x.patch 9. Build and Install transcode ./configure make make install 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 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. --- NEW FILE: MPlayer-1.0pre7_dirac-0.5.x.patch --- diff -ruN -x config.h -x config.mak -x version.h MPlayer-1.0pre7/configure MPlayer-1.0pre7-snow-dirac/configure --- MPlayer-1.0pre7/configure 2005-04-13 12:46:35.000000000 +0100 +++ MPlayer-1.0pre7-snow-dirac/configure 2005-05-12 12:41:00.000000000 +0100 @@ -229,6 +229,7 @@ --disable-amr_nb disable amr narrowband, floating point [autodetect] --disable-amr_nb-fixed disable amr narrowband, fixed point [autodetect] --disable-amr_wb disable amr wideband, floating point [autodetect] + --enable-dirac build with Dirac support [autodetect] Video output: --disable-vidix disable VIDIX [enable on x86 *nix] @@ -1411,6 +1412,7 @@ _gethostbyname2=auto _ftp=yes _vstream=auto +_dirac=auto for ac_option do case "$ac_option" in # Skip 1st pass [...1004 lines suppressed...] + } else sh_video->pts=d_video->pts; if(frame_time_ptr) *frame_time_ptr=frame_time; diff -ruN -x config.h -x config.mak -x version.h MPlayer-1.0pre7/Makefile MPlayer-1.0pre7-snow-dirac/Makefile --- MPlayer-1.0pre7/Makefile 2005-04-16 21:18:12.000000000 +0100 +++ MPlayer-1.0pre7-snow-dirac/Makefile 2005-05-12 12:45:25.000000000 +0100 @@ -32,10 +32,10 @@ VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB) $(CACA_LIB) AO_LIBS = $(ARTS_LIB) $(ESD_LIB) $(JACK_LIB) $(NAS_LIB) $(SGIAUDIO_LIB) $(POLYP_LIB) -CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(THEORA_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(DECORE_LIB) $(XVID_LIB) $(DTS_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB) $(X264_LIB) +CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(THEORA_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(DECORE_LIB) $(XVID_LIB) $(DTS_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB) $(X264_LIB) $(DIRAC_LIB) COMMON_LIBS = libmpcodecs/libmpcodecs.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a osdep/libosdep.a $(DVDREAD_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(MPLAYER_NETWORK_LIB) $(WIN32_LIB) $(GIF_LIB) $(MACOSX_FRAMEWORKS) $(SMBSUPPORT_LIB) $(FRIBIDI_LIB) $(FONTCONFIG_LIB) $(ENCA_LIB) -CFLAGS = $(OPTFLAGS) -I. $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) $(X11_INC) $(FRIBIDI_INC) $(DVB_INC) $(XVID_INC) $(FONTCONFIG_INC) $(CACA_INC) # -Wall +CFLAGS = $(OPTFLAGS) -I. $(FREETYPE_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(SDL_INC) $(X11_INC) $(FRIBIDI_INC) $(DVB_INC) $(XVID_INC) $(FONTCONFIG_INC) $(CACA_INC) $(DIRAC_INC) # -Wall ifeq ($(TOOLAME),yes) CFLAGS += $(TOOLAME_EXTRAFLAGS) CODEC_LIBS += $(TOOLAME_LIB) --- NEW FILE: ffmpeg-0.4.9-pre1-dirac-0.5.x.patch --- diff -ruN ffmpeg-0.4.9-pre1/configure ffmpeg-0.4.9-pre1-dirac/configure --- ffmpeg-0.4.9-pre1/configure 2004-07-05 19:06:16.000000000 +0100 +++ ffmpeg-0.4.9-pre1-dirac/configure 2005-05-25 10:00:28.750971956 +0100 @@ -31,6 +31,7 @@ echo " --enable-sunmlib use Sun medialib [default=no]" echo " --enable-pthreads use pthreads [default=no]" echo " --enable-gpl allow use of gpl code, the resulting libav* and ffmpeg will be under gpl [default=no]" +echo " --enable-dirac enable dirac codec support via libdirac_encoder/decoder [default=no]" echo "" echo "Advanced options (experts only):" echo " --source-path=PATH path of source code [$source_path]" @@ -178,6 +179,7 @@ amr_nb_fixed="no" sunmlib="no" pthreads="no" +dirac="no" gpl="no" memalignhack="no" [...967 lines suppressed...] st->codec.codec_id == CODEC_ID_VORBIS || + st->codec.codec_id == CODEC_ID_DIRAC || (st->codec.codec_id == CODEC_ID_MPEG4 && !st->need_parsing))) try_decode_frame(st, pkt->data, pkt->size); diff -ruN ffmpeg-0.4.9-pre1/Makefile ffmpeg-0.4.9-pre1-dirac/Makefile --- ffmpeg-0.4.9-pre1/Makefile 2004-07-08 12:02:04.000000000 +0100 +++ ffmpeg-0.4.9-pre1-dirac/Makefile 2005-05-25 10:00:28.767972719 +0100 @@ -58,6 +58,11 @@ EXTRALIBS+=-lfaac endif +ifeq ($(CONFIG_DIRAC),yes) +EXTRALIBS+= $(DIRAC_LIB) +CFLAGS+= $(DIRAC_INC) +endif + ifeq ($(BUILD_VHOOK),yes) VHOOK=videohook INSTALLVHOOK=install-vhook --- NEW FILE: README_ffmpeg-0.4.9-pre1-dirac-0.5.x_patch --- **Dirac patch for ffmpeg **Tested with ffmpeg version 0.4.9-pre1 **Author: dir...@so... Dirac is an open-source video codec currently under development. Both the encoder and decoder have been integrated with ffmpeg. This patch is only a basic integration such that only the salient paremeters are currently passed from ffmpeg to Dirac. As Dirac develops, especially with the integration of a formalised bit-stream syntax, then more complex screnarios can be dealt with. Encoded Dirac files, with the right patch, can be played back using MPlayer. Please feel free to modify/add-to the code. These are the instructions for enabling Dirac support in ffmpeg source code. 1. Download Dirac 0.5.2 from http://sourceforge.net/projects/dirac/ 2. Unpack the Dirac source tar xvzf dirac-0.5.2.tar.gz 3. Build and Install cd dirac-0.5.2 ./configure make make install The last step installs the Dirac share encoder and decoder libraries in /usr/local/lib (which is the default install point). 3. Download ffmpeg version 0.4.9-pre1 http://sourceforge.net/project/showfiles.php?group_id=16082 4. Unpack the source tar xvzf ffmpeg-0.4.9-pre1.tar.gz 5. Apply the patch cd ffmpeg-0.4.9-pre1 patch -p1 < ffmpeg-0.4.9-pre1-dirac-0.5.x.patch 6. Build and Install ./configure --enable-dirac make make install The option '--enable-dirac' must be used during configuration in order to pick-up the Dirac code during building. Sample Usage: (encoding) ffmpeg -s 720x576 -i input_file.yuv -vcodec dirac -qscale 15 -f rawvideo dirac_output.drc Currently, the output from the encoder is exactly as it is written to the .drc encoded file ( hence the '-f rawvideo' output). Dirac bit-rate is controlled by a quality-factor (currently a basic intepretation from qscale. A qscale of 1 maps to dirac uality factor 10 and 30 maps to quality factor 1) (decoding) ffmpeg -i input.drc -f rawvideo output.yuv Dirac can also be invoked via ffmpeg using transcode after applying the transcode patch. transcode -i input.avi -x raw -i raw_input.avi -y ffmpeg -F dirac,null -o dirac_output.avi --- NEW FILE: README_MPlayer-1.0pre7_dirac-0.5.x_patch --- **Dirac support in Mplayer **Tested with Mplayer version 1.0.pre7 **asu...@us... These are the instructions for enabling Dirac support in Mplayer source code. 1. Download Dirac 0.5.2 from http://sourceforge.net/projects/dirac/ 2. Unpack the Dirac source tar xvzf dirac-0.5.2.tar.gz 3. Build and Install cd dirac-0.5.2 ./configure make make install The last step installs the Dirac share encoder and decoder libraries in /usr/local/lib (which is the default install point). 3. Download the Mplayer 1.0pre7 source from http://www.mplayerhq.hu/homepage/design7/dload.html 4. Unpack the source tar xvjf MPlayer-1.0pre7.tar.bz2 5. Apply the patch cd MPlayer-1.0pre7 patch -p1 < MPlayer-1.0pre7_dirac.patch 6. Build and Install ./configure make make install (If Dirac support is enabled, HAVE_DIRAC is defined in config.h) |