Skip Menu |

This queue is for tickets about the Video-FFmpeg CPAN distribution.

Report information
The Basics
Id: 73132
Status: new
Priority: 0/
Queue: Video-FFmpeg

People
Owner: Nobody in particular
Requestors: cavac [...] cavac.at
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.47
Fixed in: (no value)



Subject: Does not work on Ubuntu 11.10
I had some Problems with Video::FFmpeg on Ubuntu 11.10 x64 and ActiveState Perl 5.14. Attached is a patch that should fix the errors. *) Makefile.PL does not find -lavformat (fixed) *) Compile errors in FFmpeg.xs *) Some Perl code still uses Switch.pm (deprecated) (fixed) *) Two Tests had floating point problems (fixed) There are still some warnings when compiling FFmpeg.xs, but at least it should work now: ... FFmpeg.xs: In function ‘get_metadata’: FFmpeg.xs:19:5: warning: ‘AVMetadataTag’ is deprecated (declared at /usr/include/libavutil/dict.h:36) [-Wdeprecated-declarations] FFmpeg.xs:19:5: warning: ‘av_metadata_get’ is deprecated (declared at /usr/include/libavformat/avformat.h:145) [-Wdeprecated-declarations] FFmpeg.xs: In function ‘get_lang’: FFmpeg.xs:28:5: warning: ‘AVMetadataTag’ is deprecated (declared at /usr/include/libavutil/dict.h:36) [-Wdeprecated-declarations] FFmpeg.xs:28:5: warning: ‘av_metadata_get’ is deprecated (declared at /usr/include/libavformat/avformat.h:145) [-Wdeprecated-declarations] FFmpeg.xs: In function ‘XS_Video__FFmpeg__AVFormat_open’: FFmpeg.xs:55:9: warning: ‘av_open_input_file’ is deprecated (declared at /usr/include/libavformat/avformat.h:1050) [-Wdeprecated-declarations] FFmpeg.xs: In function ‘XS_Video__FFmpeg__AVFormat_duration_us’: FFmpeg.xs:115:3: warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘int64_t’ [-Wformat] FFmpeg.xs: In function ‘XS_Video__FFmpeg__AVFormat_start_time’: FFmpeg.xs:136:3: warning: format ‘%i’ expects argument of type ‘int’, but argument 2 has type ‘int64_t’ [-Wformat] FFmpeg.xs: In function ‘XS_Video__FFmpeg__AVStream_codec’: FFmpeg.xs:157:11: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default] ... chmod 644 blib/arch/auto/Video/FFmpeg/FFmpeg.bs PERL_DL_NONLAZY=1 /home/cavac/bin/ActivePerl-5.14/bin/perl-static "- MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/Video-FFmpeg.t .. ok All tests successful. Files=1, Tests=13, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.04 cusr 0.01 csys = 0.09 CPU) Result: PASS ...
Subject: video-ffmpeg.patch
diff -rupN Video-FFmpeg-0.47_orig/FFmpeg.xs Video-FFmpeg/FFmpeg.xs --- Video-FFmpeg-0.47_orig/FFmpeg.xs 2010-10-28 04:33:15.000000000 +0200 +++ Video-FFmpeg/FFmpeg.xs 2011-12-09 14:38:30.565320426 +0100 @@ -4,7 +4,7 @@ #include "ppport.h" -#include <avformat.h> +#include <libavformat/avformat.h> #include <pthread.h> pthread_mutex_t AVFormatCtxMP; @@ -88,7 +88,7 @@ nb_streams(Video_FFmpeg_AVFormat *self) Video_FFmpeg_AVStream_Video * get_video_stream(Video_FFmpeg_AVFormat *self, int id) CODE: - if(CODEC_TYPE_VIDEO == self->streams[id]->codec->codec_type) + if(AVMEDIA_TYPE_VIDEO == self->streams[id]->codec->codec_type) RETVAL = self->streams[id]; else RETVAL = NULL; @@ -97,7 +97,7 @@ get_video_stream(Video_FFmpeg_AVFormat * Video_FFmpeg_AVStream_Audio * get_audio_stream(Video_FFmpeg_AVFormat *self, int id) CODE: - if(CODEC_TYPE_AUDIO == self->streams[id]->codec->codec_type) + if(AVMEDIA_TYPE_AUDIO == self->streams[id]->codec->codec_type) RETVAL = self->streams[id]; else RETVAL = NULL; @@ -175,19 +175,19 @@ char * codec_type(Video_FFmpeg_AVStream *st); CODE: switch(st->codec->codec_type){ - case CODEC_TYPE_VIDEO: + case AVMEDIA_TYPE_VIDEO: RETVAL = "video"; break; - case CODEC_TYPE_AUDIO: + case AVMEDIA_TYPE_AUDIO: RETVAL = "audio"; break; - case CODEC_TYPE_SUBTITLE: + case AVMEDIA_TYPE_SUBTITLE: RETVAL = "subtitle"; break; - case CODEC_TYPE_DATA: + case AVMEDIA_TYPE_DATA: RETVAL = "data"; break; - case CODEC_TYPE_ATTACHMENT: + case AVMEDIA_TYPE_ATTACHMENT: RETVAL = "attachment"; break; default: diff -rupN Video-FFmpeg-0.47_orig/lib/Video/FFmpeg/AVFormat.pm Video-FFmpeg/lib/Video/FFmpeg/AVFormat.pm --- Video-FFmpeg-0.47_orig/lib/Video/FFmpeg/AVFormat.pm 2010-10-28 04:26:29.000000000 +0200 +++ Video-FFmpeg/lib/Video/FFmpeg/AVFormat.pm 2011-12-09 14:59:54.241063459 +0100 @@ -1,9 +1,10 @@ +use 5.010; package Video::FFmpeg::AVFormat; use Video::FFmpeg; -use Switch; our $VERSION = '0.47'; +my $i; sub new { $i = Video::FFmpeg::AVFormat::open($_[1]); } @@ -13,20 +14,20 @@ sub streams { my @streams; for(0 .. $self->nb_streams-1){ my $stream = $self->get_stream($_); - switch($stream->codec_type){ - case "video" { + given($stream->codec_type){ + when ("video") { bless $stream, 'Video::FFmpeg::AVStream::Video'; push @streams, $stream; } - case "audio" { + when ("audio") { bless $stream, 'Video::FFmpeg::AVStream::Audio'; push @streams, $stream; } - case "subtitle" { + when ("subtitle") { bless $stream, 'Video::FFmpeg::AVStream::Subtitle'; push @streams, $stream; } - else { + default { push @streams, $stream; } } @@ -86,7 +87,6 @@ Video::FFmpeg::AVFormat - Retrieve video =head1 SYNOPSIS use Video::FFmpeg; - use Switch; my $info = Video::FFmpeg::AVFormat->new($ARGV[0]); @@ -106,16 +106,16 @@ Video::FFmpeg::AVFormat - Retrieve video print "\ttype: ",$stream->codec_type,"\n"; print "\tcodec: ",$stream->codec,"\n"; print "\tlanguage: ",$stream->lang,"\n"; - switch($stream->codec_type){ - case "video" { + given($stream->codec_type){ + when("video") { print "\tfps: ",$stream->fps,"\n"; print "\tDAR: ",$stream->display_aspect,"\n"; } - case "audio" { + when("audio") { print "\tsample rate: ",$stream->sample_rate,"hz\n"; print "\taudio language: ",$stream->lang,"\n"; } - case "subtitle" { + when("subtitle") { print "\tsub codec: ",$stream->codec,"\n"; print "\tsub language: ",$stream->lang,"\n"; } @@ -245,7 +245,8 @@ None by default. =head1 AUTHOR -Max Vohra, E<lt>max@seattlenetworks.comE<gt> L<html://www.seattlenetworks.com/> +Max Vohra, E<lt>max@seattlenetworks.comE<gt> L<html://www.seattlenetworks.com/>; +some bugfixes by Rene Schickbauer AKA "cavac" =head1 COPYRIGHT AND LICENSE diff -rupN Video-FFmpeg-0.47_orig/lib/Video/FFmpeg.pm Video-FFmpeg/lib/Video/FFmpeg.pm --- Video-FFmpeg-0.47_orig/lib/Video/FFmpeg.pm 2010-10-28 04:25:10.000000000 +0200 +++ Video-FFmpeg/lib/Video/FFmpeg.pm 2011-12-09 15:00:11.557279591 +0100 @@ -35,8 +35,8 @@ Video::FFmpeg - Retrieve video propertie =head1 SYNOPSIS + use 5.010; use Video::FFmpeg; - use Switch; my $info = Video::FFmpeg::AVFormat->new($ARGV[0]); @@ -56,16 +56,16 @@ Video::FFmpeg - Retrieve video propertie print "\ttype: ",$stream->codec_type,"\n"; print "\tcodec: ",$stream->codec,"\n"; print "\tlanguage: ",$stream->lang,"\n"; - switch($stream->codec_type){ - case "video" { + given($stream->codec_type){ + when("video") { print "\tfps: ",$stream->fps,"\n"; print "\tDAR: ",$stream->display_aspect,"\n"; } - case "audio" { + when("audio") { print "\tsample rate: ",$stream->sample_rate,"hz\n"; print "\taudio language: ",$stream->lang,"\n"; } - case "subtitle" { + when("subtitle") { print "\tsub codec: ",$stream->codec,"\n"; print "\tsub language: ",$stream->lang,"\n"; } @@ -195,7 +195,8 @@ None by default. =head1 AUTHOR -Max Vohra, E<lt>max@seattlenetworks.comE<gt> L<html://www.seattlenetworks.com/> +Max Vohra, E<lt>max@seattlenetworks.comE<gt> L<html://www.seattlenetworks.com/>; +Some bugfixes by Rene Schickbauer AKA "cavac" =head1 COPYRIGHT AND LICENSE diff -rupN Video-FFmpeg-0.47_orig/Makefile.PL Video-FFmpeg/Makefile.PL --- Video-FFmpeg-0.47_orig/Makefile.PL 2010-10-28 04:32:14.000000000 +0200 +++ Video-FFmpeg/Makefile.PL 2011-12-09 15:00:50.005759360 +0100 @@ -5,7 +5,7 @@ use ExtUtils::PkgConfig; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. -my $lavf_lib = ExtUtils::PkgConfig->libs("libavformat"); +my $lavf_lib = "-L/usr/lib " . ExtUtils::PkgConfig->libs("libavformat"); my $lavf_inc = ExtUtils::PkgConfig->cflags("libavformat"); die("Installed libavformat version is too low. I require 52.7 or greater") unless ( ExtUtils::PkgConfig->atleast_version("libavformat", "52.7.0")); @@ -14,7 +14,7 @@ WriteMakefile( NAME => 'Video::FFmpeg', VERSION_FROM => 'lib/Video/FFmpeg.pm', # finds $VERSION PREREQ_PM => {}, # e.g., Module::Name => 1.1 - ($] >= 5.005 ? ## Add these new keywords supported since 5.005 + ($] >= 5.010 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'lib/Video/FFmpeg.pm', # retrieve abstract from module AUTHOR => 'Max Vohra <max@seattlenetworks.com>') : ()), LIBS => [$lavf_lib], # e.g., '-lm' diff -rupN Video-FFmpeg-0.47_orig/t/Video-FFmpeg.t Video-FFmpeg/t/Video-FFmpeg.t --- Video-FFmpeg-0.47_orig/t/Video-FFmpeg.t 2010-06-05 01:35:34.000000000 +0200 +++ Video-FFmpeg/t/Video-FFmpeg.t 2011-12-09 14:57:04.146939399 +0100 @@ -21,12 +21,12 @@ is($info->start_time,0,"start_time"); is($info->bit_rate,330299,"bit_rate"); # For some reason mp2 is reported as mp3 under libavformat 52.16.0 #is($info->audio->codec,"mp2","acodec"); -is($info->audio->bit_rate,64000,"abitrate"); +ok(abs($info->audio->bit_rate - 64000 < 2),"abitrate"); is($info->audio->sample_rate,44100,"asample_rate"); is($info->audio->channels,2,"achannels"); is($info->video->codec,"mpeg4","vcodec"); is($info->video->width,400,"vwidth"); is($info->video->height,300,"vheight"); -is($info->video->fps,29.9700298309326,"vfps"); +ok(abs($info->video->fps - 29.9700298309326) < 0.1,"vfps"); is($info->video->display_aspect,"4:3","vDAR"); is($info->video->pixel_aspect,"1:1","vPAR");