
Recherche avancée
Médias (91)
-
Les Miserables
9 décembre 2019, par
Mis à jour : Décembre 2019
Langue : français
Type : Textuel
-
VideoHandle
8 novembre 2019, par
Mis à jour : Novembre 2019
Langue : français
Type : Video
-
Somos millones 1
21 juillet 2014, par
Mis à jour : Juin 2015
Langue : français
Type : Video
-
Un test - mauritanie
3 avril 2014, par
Mis à jour : Avril 2014
Langue : français
Type : Textuel
-
Pourquoi Obama lit il mes mails ?
4 février 2014, par
Mis à jour : Février 2014
Langue : français
-
IMG 0222
6 octobre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Image
Autres articles (49)
-
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
-
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community. -
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)
Sur d’autres sites (5528)
-
PHP FFmpeg video aspect ratio problem [SOLVED]
29 août 2011, par Herr Kaleuni compiled the new version of FFMPEG and the padding commands have been deprecated.
As i try to get familiar with the new -vf pad= commands, i want to ask, how can i
convert a video without changing it's aspect ratio.I've checked numerous solutions from stackoverflow, nothing seemed to work.
Can someone, please post a working PHP example or cmd line. I would be VERY happy.Please note that the videos in question, could be 4:3 and also be 16:9
Let's say, i convert a 16:9 video to 640x480 format. It will need some bars at
the top and at the bottom. That is what i want to do.Thanks
EDIT :
I solved the problem on my own. The FFmpeg documentation is a little bit weird so
you have to experiment yourself a little bit.
The padding formula is like :$pad_horizontal = $target_width + $pad_left + $pad_right;
$pad_vertical = $target_height;
// blah
$command .= " -vf pad=$pad_horizontal:$pad_vertical:". $pad_left .":". $pad_top .":black";Pay special attention at the $pad_vertical part since the paddings there are better
not added so that the padding calculation of ffmpeg is not broken.Here is the full source code to the demo
<?
/***********************************************************************************
get_dimensions()
Takes in a set of video dimensions - original and target - and returns the optimal conversion
dimensions. It will always return the smaller of the original or target dimensions.
For example: original dimensions of 320x240 and target dimensions of 640x480.
The result will be 320x240 because converting to 640x480 would be a waste of disk
space, processing, and bandwidth (assuming these videos are to be downloaded).
@param $original_width: The actual width of the original video file which is to be converted.
@param $original_height: The actual height of the original video file which is to be converted.
@param $target_width: The width of the video file which we will be converting to.
@param $target_height: The height of the video file which we will be converting to.
@param $force_aspect: Boolean value of whether or not to force conversion to the target's
aspect ratio using padding (so the video isn't stretched). If false, the
conversion dimensions will retain the aspect ratio of the original.
Optional parameter. Defaults to true.
@return: An array containing the size and padding information to be used for conversion.
Format:
Array
(
[width] => int
[height] => int
[padtop] => int // top padding (if applicable)
[padbottom] => int // bottom padding (if applicable)
[padleft] => int // left padding (if applicable)
[padright] => int // right padding (if applicable)
)
***********************************************************************************/
function get_dimensions($original_width,$original_height,$target_width,$target_height,$force_aspect)
{
if(!isset($force_aspect))
{
$force_aspect = true;
}
// Array to be returned by this function
$target = array();
$target['padleft'] = 0;
$target['padright'] = 0;
$target['padbottom'] = 0;
$target['padtop'] = 0;
// Target aspect ratio (width / height)
$aspect = $target_width / $target_height;
// Target reciprocal aspect ratio (height / width)
$raspect = $target_height / $target_width;
if($original_width/$original_height !== $aspect)
{
// Aspect ratio is different
if($original_width/$original_height > $aspect)
{
// Width is the greater of the two dimensions relative to the target dimensions
if($original_width < $target_width)
{
// Original video is smaller. Scale down dimensions for conversion
$target_width = $original_width;
$target_height = round($raspect * $target_width);
}
// Calculate height from width
$original_height = round($original_height / $original_width * $target_width);
$original_width = $target_width;
if($force_aspect)
{
// Pad top and bottom
$dif = round(($target_height - $original_height) / 2);
$target['padtop'] = $dif;
$target['padbottom'] = $dif;
}
}
else
{
// Height is the greater of the two dimensions relative to the target dimensions
if($original_height < $target_height)
{
// Original video is smaller. Scale down dimensions for conversion
$target_height = $original_height;
$target_width = round($aspect * $target_height);
}
//Calculate width from height
$original_width = round($original_width / $original_height * $target_height);
$original_height = $target_height;
if($force_aspect)
{
// Pad left and right
$dif = round(($target_width - $original_width) / 2);
$target['padleft'] = $dif;
$target['padright'] = $dif;
}
}
}
else
{
// The aspect ratio is the same
if($original_width !== $target_width)
{
if($original_width < $target_width)
{
// The original video is smaller. Use its resolution for conversion
$target_width = $original_width;
$target_height = $original_height;
}
else
{
// The original video is larger, Use the target dimensions for conversion
$original_width = $target_width;
$original_height = $target_height;
}
}
}
if($force_aspect)
{
// Use the target_ vars because they contain dimensions relative to the target aspect ratio
$target['width'] = $target_width;
$target['height'] = $target_height;
}
else
{
// Use the original_ vars because they contain dimensions relative to the original's aspect ratio
$target['width'] = $original_width;
$target['height'] = $original_height;
}
return $target;
}
function get_vid_dim($file)
{
$command = '/usr/bin/ffmpeg -i ' . escapeshellarg($file) . ' 2>&1';
$dimensions = array();
exec($command,$output,$status);
if (!preg_match('/Stream #(?:[0-9\.]+)(?:.*)\: Video: (?P<videocodec>.*) (?P<width>[0-9]*)x(?P<height>[0-9]*)/',implode("\n",$output),$matches))
{
preg_match('/Could not find codec parameters \(Video: (?P<videocodec>.*) (?P<width>[0-9]*)x(?P<height>[0-9]*)\)/',implode("\n",$output),$matches);
}
if(!empty($matches['width']) && !empty($matches['height']))
{
$dimensions['width'] = $matches['width'];
$dimensions['height'] = $matches['height'];
}
return $dimensions;
}
$command = '/usr/bin/ffmpeg -i ' . $src . ' -ab 96k -b 700k -ar 44100 -f flv -s ' . '640x480 -acodec mp3 '. $video_output_dir . $video_filename . ' 2>&1';
define( 'VIDEO_WIDTH', '640' );
define( 'VIDEO_HEIGHT', '480' );
$src_1 = getcwd() .'/'. 'test_video1.mpeg';
$video_filename1 = 'video1.flv';
$src_2 = getcwd() .'/'. 'test_video2.mp4';
$video_filename2 = 'video2.flv';
$src_3 = getcwd() .'/'. 'test_video3.mp4';
$video_filename3 = 'video3.flv';
convert_video( $src_1, $video_filename1 );
convert_video( $src_2, $video_filename2 );
convert_video( $src_3, $video_filename3 );
function convert_video( $src = '', $video_filename = '' )
{
$video_output_dir = getcwd() .'/';
@unlink ( $video_output_dir . $video_filename );
$original = get_vid_dim($src);
$target = get_dimensions( $original['width'], $original['height'], VIDEO_WIDTH, VIDEO_HEIGHT, TRUE );
echo '<pre>';
print_r( $original );
echo '</pre>';
echo '<pre>';
print_r( $target );
echo '</pre>';
$target_width = $target['width'];
$target_height = $target['height'];
$pad_left = $target['padleft'];
$pad_right = $target['padright'];
$pad_bottom = $target['padbottom'];
$pad_top = $target['padtop'];
$pad_horizontal = $target_width + $pad_left + $pad_right;
$pad_vertical = $target_height; // + $pad_top + $pad_bottom;
$command = '/usr/bin/ffmpeg -i ' . $src;
// $command .= " -s {$target_width}x{$target_height} ";
$command .= " -vf pad=$pad_horizontal:$pad_vertical:". $pad_left .":". $pad_top .":black";
$command .= ' -ab 96k -b 700k -ar 44100';
$command .= ' -f flv ';
$command .= ' -qscale 4';
$command .= ' -ss 30';
$command .= ' -t 5';
$command .= ' -ac 2 -ab 128k -qscale 5 ';
$command .= ' ' . $video_output_dir . $video_filename;
exec( $command, $output, $status );
echo '<pre>';
print_r( $command );
echo '</pre>';
if ( $status == 0 )
{
echo '<br />Convert OK. <br />';
}
else
{
echo '<pre>';
print_r( $output );
echo '</pre>';
}
echo '<br />';
echo '<br />';
}
?>
</height></width></videocodec></height></width></videocodec>Thank you and have fun :)
-
CD-R Read Speed Experiments
21 mai 2011, par Multimedia Mike — Science Projects, Sega DreamcastI want to know how fast I can really read data from a CD-R. Pursuant to my previous musings on this subject, I was informed that it is inadequate to profile reading just any file from a CD-R since data might be read faster or slower depending on whether the data is closer to the inside or the outside of the disc.
Conclusion / Executive Summary
It is 100% true that reading data from the outside of a CD-R is faster than reading data from the inside. Read on if you care to know the details of how I arrived at this conclusion, and to find out just how much speed advantage there is to reading from the outside rather than the inside.Science Project Outline
- Create some sample CD-Rs with various properties
- Get a variety of optical drives
- Write a custom program that profiles the read speed
Creating The Test Media
It’s my understanding that not all CD-Rs are created equal. Fortunately, I have 3 spindles of media handy : Some plain-looking Memorex discs, some rather flamboyant Maxell discs, and those 80mm TDK discs :
My approach for burning is to create a single file to be burned into a standard ISO-9660 filesystem. The size of the file will be the advertised length of the CD-R minus 1 megabyte for overhead— so, 699 MB for the 120mm discs, 209 MB for the 80mm disc. The file will contain a repeating sequence of 0..0xFF bytes.
Profiling
I don’t want to leave this to the vagaries of any filesystem handling layer so I will conduct this experiment at the sector level. Profiling program outline :- Read the CD-ROM TOC and get the number of sectors that comprise the data track
- Profile reading the first 20 MB of sectors
- Profile reading 20 MB of sectors in the middle of the track
- Profile reading the last 20 MB of sectors
Unfortunately, I couldn’t figure out the raw sector reading on modern Linux incarnations (which is annoying since I remember it being pretty straightforward years ago). So I left it to the filesystem after all. New algorithm :
- Open the single, large file on the CD-R and query the file length
- Profile reading the first 20 MB of data, 512 kbytes at a time
- Profile reading 20 MB of sectors in the middle of the track (starting from filesize / 2 - 10 MB), 512 kbytes at a time
- Profile reading the last 20 MB of sectors (starting from filesize - 20MB), 512 kbytes at a time
Empirical Data
I tested the program in Linux using an LG Slim external multi-drive (seen at the top of the pile in this post) and one of my Sega Dreamcast units. I gathered the median value of 3 runs for each area (inner, middle, and outer). I also conducted a buffer flush in between Linux runs (as root :'sync; echo 3 > /proc/sys/vm/drop_caches'
).LG Slim external multi-drive (reading from inner, middle, and outer areas in kbytes/sec) :
- TDK-80mm : 721, 897, 1048
- Memorex-120mm : 1601, 2805, 3623
- Maxell-120mm : 1660, 2806, 3624
So the 120mm discs can range from about 10.5X all the way up to a full 24X on this drive. For whatever reason, the 80mm disc fares a bit worse — even at the inner track — with a range of 4.8X - 7X.
Sega Dreamcast (reading from inner, middle, and outer areas in kbytes/sec) :
- TDK-80mm : 502, 632, 749
- Memorex-120mm : 499, 889, 1143
- Maxell-120mm : 500, 890, 1156
It’s interesting that the 80mm disc performed comparably to the 120mm discs in the Dreamcast, in contrast to the LG Slim drive. Also, the results are consistent with my previous profiling experiments, which largely only touched the inner area. The read speeds range from 3.3X - 7.7X. The middle of a 120mm disc reads at about 6X.
Implications
A few thoughts regarding these results :- Since the very definition of 1X is the minimum speed necessary to stream data from an audio CD, then presumably, original 1X CD-ROM drives would have needed to be capable of reading 1X from the inner area. I wonder what the max read speed at the outer edges was ? It’s unlikely I would be able to get a 1X drive working easily in this day and age since the earliest CD-ROM drives required custom controllers.
- I think 24X is the max rated read speed for CD-Rs, at least for this drive. This implies that the marketing literature only cites the best possible numbers. I guess this is no surprise, similar to how monitors and TVs have always been measured by their diagonal dimension.
- Given this data, how do you engineer an ISO-9660 filesystem image so that the timing-sensitive multimedia files live on the outermost track ? In the Dreamcast case, if you can guarantee your FMV files will live somewhere between the middle and the end of the disc, you should be able to count on a bitrate of at least 900 kbytes/sec.
Source Code
Here is the program I wrote for profiling. Note that the filename is hardcoded (#define FILENAME
). Compiling for Linux is a simple'gcc -Wall profile-cdr.c -o profile-cdr'
. Compiling for Dreamcast is performed in the standard KallistiOS manner (people skilled in the art already know what they need to know) ; the only variation is to compile with the'-D_arch_dreamcast'
flag, which the default KOS environment adds anyway.C :-
#ifdef _arch_dreamcast
-
#include <kos .h>
-
-
/* map I/O functions to their KOS equivalents */
-
#define open fs_open
-
#define lseek fs_seek
-
#define read fs_read
-
#define close fs_close
-
-
#define FILENAME "/cd/bigfile"
-
#else
-
#include <stdio .h>
-
#include <sys /types.h>
-
#include </sys><sys /stat.h>
-
#include </sys><sys /time.h>
-
#include <fcntl .h>
-
#include <unistd .h>
-
-
#define FILENAME "/media/Full disc/bigfile"
-
#endif
-
-
/* Get a current absolute millisecond count ; it doesn’t have to be in
-
* reference to anything special. */
-
unsigned int get_current_milliseconds()
-
{
-
#ifdef _arch_dreamcast
-
return timer_ms_gettime64() ;
-
#else
-
struct timeval tv ;
-
gettimeofday(&tv, NULL) ;
-
return tv.tv_sec * 1000 + tv.tv_usec / 1000 ;
-
#endif
-
}
-
-
#define READ_SIZE (20 * 1024 * 1024)
-
#define READ_BUFFER_SIZE (512 * 1024)
-
-
int main()
-
{
-
int i, j ;
-
int fd ;
-
char read_buffer[READ_BUFFER_SIZE] ;
-
off_t filesize ;
-
unsigned int start_time, end_time ;
-
-
fd = open(FILENAME, O_RDONLY) ;
-
if (fd == -1)
-
{
-
return 1 ;
-
}
-
filesize = lseek(fd, 0, SEEK_END) ;
-
-
for (i = 0 ; i <3 ; i++)
-
{
-
if (i == 0)
-
{
-
lseek(fd, 0, SEEK_SET) ;
-
}
-
else if (i == 1)
-
{
-
lseek(fd, (filesize / 2) - (READ_SIZE / 2), SEEK_SET) ;
-
}
-
else
-
{
-
lseek(fd, filesize - READ_SIZE, SEEK_SET) ;
-
}
-
/* read 20 MB ; 40 chunks of 1/2 MB */
-
start_time = get_current_milliseconds() ;
-
for (j = 0 ; j <(READ_SIZE / READ_BUFFER_SIZE) ; j++)
-
if (read(fd, read_buffer, READ_BUFFER_SIZE) != READ_BUFFER_SIZE)
-
{
-
break ;
-
}
-
end_time = get_current_milliseconds() ;
-
end_time, start_time, end_time - start_time,
-
READ_SIZE / (end_time - start_time)) ;
-
}
-
-
close(fd) ;
-
-
return 0 ;
-
}
-
Easy Tricks for Finding WebM Videos in YouTube
9 août 2010, par noreply@blogger.com (John Luther)Since the WebM project launch, YouTube has been encoding videos uploaded at 720p or higher resolution in the WebM format. Today, the one million most popular videos of any size on YouTube are also available in the WebM format.
We have instructions on our project site for finding these videos but they require adding a special parameter onto the end of each search query. All of the browsers that support WebM can create search shortcuts with custom parameters, however, so we’ve compiled instructions for making it very simple to search for WebM videos in YouTube.
Important : First, make sure you have a supported browser and are enrolled in the YouTube HTML5 beta by going to http://youtube.com/html5 and clicking Enter the HTML5 Beta.
Creating a WebM Search Shortcut
- Select Bookmarks > Organize Bookmarks. A bookmark manager dialog opens.
- In the left column, choose a location for the new bookmark you’re creating. Next, choose Organize > New Bookmark (on MacOS click the gear icon). The new bookmark dialog opens.
- In the Name box, type WebM.
- In the Location box, type http://youtube.com/results?search_query=%s&webm=1.
- In the Keyword box, type webm.
- Click Add.
Google Chrome Early Release Channel :
- On Windows and Linux, click the Chrome wrench icon in the toolbar and select Options. On MacOS, select Chrome > Preferences.
- On the Basics tab, click the Manage button in the Default Search section.
- On Windows and Linux, click Add. On MacOS X, click the plus (+) button.
- In the Name box, type WebM.
- In the Keyword box, type webm.
- In the URL box, type http://youtube.com/results?search_query=%s&webm=1.
- Click OK.
- Go to http://youtube.com.
- Right-click in the YouTube search box at the top of the page and select Create Search. On MacOS, use Ctrl+click if you don’t a secondary mouse button enabled.
- In the Name box, type WebM.
- In the Keyword box, type webm.
- In the Address box, type http://youtube.com/results?search_query=%s&webm=1.
- Click OK.
Now you’re ready to search. In the location box of the browser, type webm monster trucks. The YouTube search results page will open with a selection of monster truck videos encoded in the WebM format. When watching a video, look for the HTML5 WebM indicator in the player control bar.If you can’t find WebM videos it is most likely a browser cookie problem. Your enrollment in the YouTube HTML5 beta test is stored in a browser cookie (not in your YouTube or Google account), and that cookie can expire. Visit http://youtube.com/html5 and opt-in again to re-set the cookie.
Directly Accessing WebM Videos by URL
To find out if any YouTube video is available in WebM, simply add &html5=True (make sure True is capitalized) to the end of the video URL. If there is a WebM version of the video, it will open instead of the Flash version. For example :
- Flash version : http://www.youtube.com/watch?v=Dz6gFokvOr0
- WebM version : http://www.youtube.com/watch?v=Dz6gFokvOr0&html5=True