
Recherche avancée
Médias (91)
-
Spitfire Parade - Crisis
15 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Wired NextMusic
14 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (60)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)
Sur d’autres sites (4584)
-
Revision 32596 : minuscules et fin pour aujourd’hui
1er novembre 2009, par fil@… — Logminuscules et fin pour aujourd’hui
-
javax.media.NoDataSinkException
23 novembre 2022, par DivyaI am trying to convert Jpeg images into .mov video file



package com.ecomm.pl4mms.test;

import java.io.*;
import java.util.*;
import java.awt.Dimension;

import javax.media.*;
import javax.media.control.*;
import javax.media.protocol.*;
import javax.media.protocol.DataSource;
import javax.media.datasink.*;
import javax.media.format.VideoFormat;
import javax.media.format.JPEGFormat;

public class JpegImagesToMovie implements ControllerListener, DataSinkListener {

 public boolean doItPath(int width, int height, int frameRate, Vector inFiles, String outputURL) {
 // Check for output file extension.
 if (!outputURL.endsWith(".mov") && !outputURL.endsWith(".MOV")) {
 // System.err.println("The output file extension should end with a
 // .mov extension");
 prUsage();
 }

 // Generate the output media locators.
 MediaLocator oml;

 if ((oml = createMediaLocator("file:" + outputURL)) == null) {
 // System.err.println("Cannot build media locator from: " +
 // outputURL);
 //System.exit(0);
 }

 boolean success = doIt(width, height, frameRate, inFiles, oml);

 System.gc();
 return success;
 }

 public boolean doIt(int width, int height, int frameRate, Vector inFiles, MediaLocator outML) {
 try {
 System.out.println(inFiles.size());
 ImageDataSource ids = new ImageDataSource(width, height, frameRate, inFiles);

 Processor p;

 try {
 // System.err.println("- create processor for the image
 // datasource ...");
 System.out.println("processor");
 p = Manager.createProcessor(ids);
 System.out.println("success");
 } catch (Exception e) {
 // System.err.println("Yikes! Cannot create a processor from the
 // data source.");
 return false;
 }

 p.addControllerListener(this);

 // Put the Processor into configured state so we can set
 // some processing options on the processor.
 p.configure();
 if (!waitForState(p, p.Configured)) {
 System.out.println("Issue configuring");
 // System.err.println("Failed to configure the processor.");
 p.close();
 p.deallocate();
 return false;
 }
 System.out.println("Configured");

 // Set the output content descriptor to QuickTime.
 p.setContentDescriptor(new ContentDescriptor(FileTypeDescriptor.QUICKTIME));
System.out.println(outML);
 // Query for the processor for supported formats.
 // Then set it on the processor.
 TrackControl tcs[] = p.getTrackControls();
 Format f[] = tcs[0].getSupportedFormats();
 System.out.println(f[0].getEncoding());
 if (f == null || f.length <= 0) {
 System.err.println("The mux does not support the input format: " + tcs[0].getFormat());
 p.close();
 p.deallocate();
 return false;
 }

 tcs[0].setFormat(f[0]);

 // System.err.println("Setting the track format to: " + f[0]);

 // We are done with programming the processor. Let's just
 // realize it.
 p.realize();
 if (!waitForState(p, p.Realized)) {
 // System.err.println("Failed to realize the processor.");
 p.close();
 p.deallocate();
 return false;
 }

 // Now, we'll need to create a DataSink.
 DataSink dsink;
 if ((dsink = createDataSink(p, outML)) == null) {
 // System.err.println("Failed to create a DataSink for the given
 // output MediaLocator: " + outML);
 p.close();
 p.deallocate();
 return false;
 }

 dsink.addDataSinkListener(this);
 fileDone = false;

 // System.err.println("start processing...");

 // OK, we can now start the actual transcoding.
 try {
 p.start();
 dsink.start();
 } catch (IOException e) {
 p.close();
 p.deallocate();
 dsink.close();
 // System.err.println("IO error during processing");
 return false;
 }

 // Wait for EndOfStream event.
 waitForFileDone();

 // Cleanup.
 try {
 dsink.close();
 } catch (Exception e) {
 }
 p.removeControllerListener(this);

 // System.err.println("...done processing.");

 p.close();

 return true;
 } catch (NotConfiguredError e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }

 return false;
 }

 /**
 * Create the DataSink.
 */
 DataSink createDataSink(Processor p, MediaLocator outML) {
System.out.println("In data sink");
 DataSource ds;

 if ((ds = p.getDataOutput()) == null) {
 System.out.println("Something is really wrong: the processor does not have an output DataSource");
 return null;
 }

 DataSink dsink;

 try {
 System.out.println("- create DataSink for: " + ds.toString()+ds.getContentType());
 dsink = Manager.createDataSink(ds, outML);
 dsink.open();
 System.out.println("Done data sink");
 } catch (Exception e) {
 System.err.println("Cannot create the DataSink: " +e);
 e.printStackTrace();
 return null;
 }

 return dsink;
 }

 Object waitSync = new Object();
 boolean stateTransitionOK = true;

 /**
 * Block until the processor has transitioned to the given state. Return
 * false if the transition failed.
 */
 boolean waitForState(Processor p, int state) {
 synchronized (waitSync) {
 try {
 while (p.getState() < state && stateTransitionOK)
 waitSync.wait();
 } catch (Exception e) {
 }
 }
 return stateTransitionOK;
 }

 /**
 * Controller Listener.
 */
 public void controllerUpdate(ControllerEvent evt) {

 if (evt instanceof ConfigureCompleteEvent || evt instanceof RealizeCompleteEvent
 || evt instanceof PrefetchCompleteEvent) {
 synchronized (waitSync) {
 stateTransitionOK = true;
 waitSync.notifyAll();
 }
 } else if (evt instanceof ResourceUnavailableEvent) {
 synchronized (waitSync) {
 stateTransitionOK = false;
 waitSync.notifyAll();
 }
 } else if (evt instanceof EndOfMediaEvent) {
 evt.getSourceController().stop();
 evt.getSourceController().close();
 }
 }

 Object waitFileSync = new Object();
 boolean fileDone = false;
 boolean fileSuccess = true;

 /**
 * Block until file writing is done.
 */
 boolean waitForFileDone() {
 synchronized (waitFileSync) {
 try {
 while (!fileDone)
 waitFileSync.wait();
 } catch (Exception e) {
 }
 }
 return fileSuccess;
 }

 /**
 * Event handler for the file writer.
 */
 public void dataSinkUpdate(DataSinkEvent evt) {

 if (evt instanceof EndOfStreamEvent) {
 synchronized (waitFileSync) {
 fileDone = true;
 waitFileSync.notifyAll();
 }
 } else if (evt instanceof DataSinkErrorEvent) {
 synchronized (waitFileSync) {
 fileDone = true;
 fileSuccess = false;
 waitFileSync.notifyAll();
 }
 }
 }

 public static void main(String arg[]) {
 try {
 String args[] = { "-w 100 -h 100 -f 100 -o F:\\test.mov F:\\Text69.jpg F:\\Textnew.jpg" };
 if (args.length == 0)
 prUsage();

 // Parse the arguments.
 int i = 0;
 int width = -1, height = -1, frameRate = 1;
 Vector inputFiles = new Vector();
 String outputURL = null;

 while (i < args.length) {

 if (args[i].equals("-w")) {
 i++;
 if (i >= args.length)
 width = new Integer(args[i]).intValue();
 } else if (args[i].equals("-h")) {
 i++;
 if (i >= args.length)
 height = new Integer(args[i]).intValue();
 } else if (args[i].equals("-f")) {
 i++;
 if (i >= args.length)
 frameRate = new Integer(args[i]).intValue();
 } else if (args[i].equals("-o")) {
 System.out.println("in ou");
 i++;
 System.out.println(i);
 if (i >= args.length)
 outputURL = args[i];
 System.out.println(outputURL);
 } else {
 System.out.println("adding"+args[i]);
 inputFiles.addElement(args[i]);
 }
 i++;

 }
 inputFiles.addElement("F:\\Textnew.jpg");
 outputURL = "F:\\test.mov";
 System.out.println(inputFiles.size() + outputURL);
 if (outputURL == null || inputFiles.size() == 0)
 prUsage();

 // Check for output file extension.
 if (!outputURL.endsWith(".mov") && !outputURL.endsWith(".MOV")) {
 System.err.println("The output file extension should end with a .mov extension");
 prUsage();
 }
 width = 100;
 height = 100;
 if (width < 0 || height < 0) {
 System.err.println("Please specify the correct image size.");
 prUsage();
 }

 // Check the frame rate.
 if (frameRate < 1)
 frameRate = 1;

 // Generate the output media locators.
 MediaLocator oml;
 oml = createMediaLocator(outputURL);
 System.out.println("Media" + oml);
 if (oml == null) {
 System.err.println("Cannot build media locator from: " + outputURL);
 // //System.exit(0);
 }
 System.out.println("Before change");
System.out.println(inputFiles.size());
 JpegImagesToMovie imageToMovie = new JpegImagesToMovie();
 boolean status = imageToMovie.doIt(width, height, frameRate, inputFiles, oml);
 System.out.println("Status"+status);
 //System.exit(0);
 } catch (Exception e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }
 }

 static void prUsage() {
 System.err.println(
 "Usage: java JpegImagesToMovie -w <width> -h <height> -f -o <output url="url"> <input jpeg="jpeg" file="file" 1="1" /> <input jpeg="jpeg" file="file" 2="2" /> ...");
 //System.exit(-1);
 }

 /**
 * Create a media locator from the given string.
 */
 static MediaLocator createMediaLocator(String url) {
 System.out.println(url);
 MediaLocator ml;

 if (url.indexOf(":") > 0 && (ml = new MediaLocator(url)) != null)
 return ml;

 if (url.startsWith(File.separator)) {
 if ((ml = new MediaLocator("file:" + url)) != null)
 return ml;
 } else {
 String file = "file:" + System.getProperty("user.dir") + File.separator + url;
 if ((ml = new MediaLocator(file)) != null)
 return ml;
 }

 return null;
 }

 ///////////////////////////////////////////////
 //
 // Inner classes.
 ///////////////////////////////////////////////

 /**
 * A DataSource to read from a list of JPEG image files and turn that into a
 * stream of JMF buffers. The DataSource is not seekable or positionable.
 */
 class ImageDataSource extends PullBufferDataSource {

 ImageSourceStream streams[];

 ImageDataSource(int width, int height, int frameRate, Vector images) {
 streams = new ImageSourceStream[1];
 streams[0] = new ImageSourceStream(width, height, frameRate, images);
 }

 public void setLocator(MediaLocator source) {
 }

 public MediaLocator getLocator() {
 return null;
 }

 /**
 * Content type is of RAW since we are sending buffers of video frames
 * without a container format.
 */
 public String getContentType() {
 return ContentDescriptor.RAW;
 }

 public void connect() {
 }

 public void disconnect() {
 }

 public void start() {
 }

 public void stop() {
 }

 /**
 * Return the ImageSourceStreams.
 */
 public PullBufferStream[] getStreams() {
 return streams;
 }

 /**
 * We could have derived the duration from the number of frames and
 * frame rate. But for the purpose of this program, it's not necessary.
 */
 public Time getDuration() {
 return DURATION_UNKNOWN;
 }

 public Object[] getControls() {
 return new Object[0];
 }

 public Object getControl(String type) {
 return null;
 }
 }

 /**
 * The source stream to go along with ImageDataSource.
 */
 class ImageSourceStream implements PullBufferStream {

 Vector images;
 int width, height;
 VideoFormat format;

 int nextImage = 0; // index of the next image to be read.
 boolean ended = false;

 public ImageSourceStream(int width, int height, int frameRate, Vector images) {
 this.width = width;
 this.height = height;
 this.images = images;

 format = new JPEGFormat(new Dimension(width, height), Format.NOT_SPECIFIED, Format.byteArray,
 (float) frameRate, 75, JPEGFormat.DEC_422);
 }

 /**
 * We should never need to block assuming data are read from files.
 */
 public boolean willReadBlock() {
 return false;
 }

 /**
 * This is called from the Processor to read a frame worth of video
 * data.
 */
 public void read(Buffer buf) throws IOException {

 // Check if we've finished all the frames.
 if (nextImage >= images.size()) {
 // We are done. Set EndOfMedia.
 System.err.println("Done reading all images.");
 buf.setEOM(true);
 buf.setOffset(0);
 buf.setLength(0);
 ended = true;
 return;
 }

 String imageFile = (String) images.elementAt(nextImage);
 nextImage++;

 System.err.println(" - reading image file: " + imageFile);

 // Open a random access file for the next image.
 RandomAccessFile raFile;
 raFile = new RandomAccessFile(imageFile, "r");

 byte data[] = null;

 // Check the input buffer type & size.

 if (buf.getData() instanceof byte[])
 data = (byte[]) buf.getData();

 // Check to see the given buffer is big enough for the frame.
 if (data == null || data.length < raFile.length()) {
 data = new byte[(int) raFile.length()];
 buf.setData(data);
 }

 // Read the entire JPEG image from the file.
 raFile.readFully(data, 0, (int) raFile.length());

 System.err.println(" read " + raFile.length() + " bytes.");

 buf.setOffset(0);
 buf.setLength((int) raFile.length());
 buf.setFormat(format);
 buf.setFlags(buf.getFlags() | buf.FLAG_KEY_FRAME);

 // Close the random access file.
 raFile.close();
 }

 /**
 * Return the format of each video frame. That will be JPEG.
 */
 public Format getFormat() {
 return format;
 }

 public ContentDescriptor getContentDescriptor() {
 return new ContentDescriptor(ContentDescriptor.RAW);
 }

 public long getContentLength() {
 return 0;
 }

 public boolean endOfStream() {
 return ended;
 }

 public Object[] getControls() {
 return new Object[0];
 }

 public Object getControl(String type) {
 return null;
 }
 }
}
</output></height></width>



I am getting



Cannot create the DataSink: javax.media.NoDataSinkException: Cannot find a DataSink for: com.sun.media.multiplexer.BasicMux$BasicMuxDataSource@d7b1517
javax.media.NoDataSinkException: Cannot find a DataSink for: com.sun.media.multiplexer.BasicMux$BasicMuxDataSource@d7b1517
 at javax.media.Manager.createDataSink(Manager.java:1894)
 at com.ecomm.pl4mms.test.JpegImagesToMovie.createDataSink(JpegImagesToMovie.java:168)
 at com.ecomm.pl4mms.test.JpegImagesToMovie.doIt(JpegImagesToMovie.java:104)
 at com.ecomm.pl4mms.test.JpegImagesToMovie.main(JpegImagesToMovie.java:330)




Please help me to resolve this and let me what can be the cause of this



I am using java 1.8 and trying to create video with jpeg images and using



javax.media to perform this action. and i followed http://www.oracle.com/technetwork/java/javase/documentation/jpegimagestomovie-176885.html
to write the code


-
where to put the watermark png file in this code ?
15 août 2017, par asifthis is a line from ffmpeg video converter php script ;
$ffmpeg." -i ".$video_to_convert." -vcodec flv -f flv -r 30 -b ".$quality."-ab 128000 -ar".$audio." -s ".$size." ".$converted_vids.$name.".".$new_format."
where :
.$video_to_convert. = input file
.$converted_vids.$name. = output file
.$new_format. ; = file extention format
now i want to add watermark.png file, if i put any where i got error conversion
as i added the linelogo.png -filter_complex 'overlay
in video quality line, i got errorError ;
ffmpeg version N-71954-gbc6f84f Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16)
configuration: --prefix=/usr --enable-version3 --enable-gpl --enable-shared --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libvpx --enable-libx264 --enable-libxvid --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-postproc --enable-nonfree --enable-pthreads --enable-x11grab --enable-libfaac --enable-libopenjpeg --enable-zlib --disable-doc
libavutil 54. 23.101 / 54. 23.101
libavcodec 56. 37.101 / 56. 37.101
libavformat 56. 31.102 / 56. 31.102
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'uploaded/1502801111_21.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf56.31.102
Duration: 00:02:27.32, start: 0.023220, bitrate: 635 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 480x320 [SAR 1:1 DAR 3:2], 476 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 151 kb/s (default)
Metadata:
handler_name : SoundHandler
Please use -b:a or -b:v, -b is ambiguous
Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_overlay_0This is index.php file scipt of conversion :
v<?php include("templates/header.php");?>
<div>
<?php
require_once('languages/en.php');
include ("includes/settings.php");
include("includes/functions.php");
include("includes/LIB_parse.php");
include("classes/other.php");
cron(); // to run cron job to delete all files
if(isset($_POST['uploader_0_name']) or isset ($_GET['uploaded_name']))
{
if(isset($_POST['uploader_0_name']))
{
list($_SESSION['original_name'], $ext) = explode('.',$_POST['uploader_0_name']);
}else{
$fullname=$_GET['uploaded_name'];
}
if(isset($_POST['uploader_0_name']))
{
list($_SESSION['original_name'], $ext) = explode('.',$_POST['uploader_0_name']);
}else{
list($_SESSION['original_name'], $ext) = explode('.',$_GET['uploaded_name']);
$_SESSION['original_name']= return_between($_GET['uploaded_name'], '_', "$ext", 'EXCL') ;
$_SESSION['original_name']= str_replace(".","",$_SESSION['original_name']);
}
if(isset($_POST['uploader_0_name']))
{
$fullname= $_POST['uploader_0_tmpname'];
}else{
$fullname=$_GET['uploaded_name'];
}
$ext= pathinfo($fullname, PATHINFO_EXTENSION);
$_SESSION['name']=RemoveExtension($fullname);
$store_dir="uploaded/";
$_SESSION['converted_vids']=$converted_vids;
$_SESSION['temp_dir']=$store_dir;
// if those directotires don't exist - create them and give them read/write permissions
if(!is_dir($store_dir)) mkdir($store_dir, 0777);
if(!is_dir($converted_vids)) mkdir($converted_vids, 0777);
$extension = substr($fullname, strrpos($fullname, "."));
$extension = strtolower($extension);
$video_to_convert=$store_dir.$_SESSION['name'];
$_SESSION['video_to_convert']=$video_to_convert;
$_SESSION['extension']=$extension;
/*******************************
check extenxions
***************************************************/
if (!in_array($ext, $allowedExtensions))
{
echo '<div style="text-align:center"><strong>'.$ext."</strong><br /> is an invalid file type!<br />Supported files are:<br /><strong>";
foreach ($allowedExtensions as $value) { echo $value . "<br />"; }
echo "</strong><br />";
echo "<a href="http://stackoverflow.com/feeds/tag/\"index.php\"">"."<img src="http://stackoverflow.com/feeds/tag/\"images/red-back.png\"" border="\"0\"" style='max-width: 300px; max-height: 300px' /></a></div>";
include("templates/footer.php");
exit;
}
?>
<center>
<form action="index.php" method="post" target="_self">
<br />
<fieldset>
<legend class="show_legend">Convert To</legend>
<div class="radio_buttons">
<img alt="" src="http://stackoverflow.com/feeds/tag/images/flv.jpg" class="format_button" style='max-width: 300px; max-height: 300px' />
<input type="radio" class="blue_font" value="flv" />
<img alt="" src="http://stackoverflow.com/feeds/tag/images/mp4.jpg" class="format_button" style='max-width: 300px; max-height: 300px' />
<input type="radio" value="mp4" />
<img alt="" src="http://stackoverflow.com/feeds/tag/images/wmv.png" class="format_button" style='max-width: 300px; max-height: 300px' />
<input type="radio" value="wmv" />
<img alt="" src="http://stackoverflow.com/feeds/tag/images/avi.png" class="format_button" style='max-width: 300px; max-height: 300px' />
<input type="radio" value="avi" />
<img alt="" src="http://stackoverflow.com/feeds/tag/images/mp3.png" class="format_button" style='max-width: 300px; max-height: 300px' />
<input type="radio" value="mp3" />
<img alt="" src="http://stackoverflow.com/feeds/tag/images/ogg.png" class="format_button" style='max-width: 300px; max-height: 300px' />
<input type="radio" value="ogg" />
<img alt="" src="http://stackoverflow.com/feeds/tag/images/webm.png" class="format_button" style='max-width: 300px; max-height: 300px' />
<input type="radio" value="webm" />
</div>
</fieldset>
<fieldset>
<legend class="show_legend">Optional settings</legend>
<div class="radio_buttons" style="display:inline;padding:10px">
<br />Video quality:
<select class="radio_buttons" disabled="disabled">
<option value="2000000">high</option>
<option value="logo.png -filter_complex 'overlay' ">medium</option>
<option value="-i seen.png \-filter_complex '[0:v][1:v]overlay=10:10:enable=between(t\,15\,25)' -c:v libx264 -pix_fmt yuv420p -movflags faststart">Seen</option>
<option value="-i logo2.png \-filter_complex '[0:v][1:v]overlay=10:10:enable=between(t\,10\,20)'">HD Watermark</option>
<option value="-i logo.png -filter_complex 'overlay'">Watermark</option>
<option value="-vf drawtext='fontsize=20:y=h-line_h-10:x=(2*n)-tw:fontfile='op.ttf':text='DesiBombs.com'' -c:v libx264 -pix_fmt yuv420p -movflags faststart">Watermark</option>
</select>
</div>
<div class="radio_buttons" style="display:inline;padding:10px">Audio quality:
<select class="radio_buttons" disabled="disabled">
<option value="44100">high</option>
<option value="22050">medium</option>
<option value="11025">low</option>
</select>
<div class="radio_buttons" style="display:inline;padding:10px">Video size:
<select class="radio_buttons" disabled="disabled">
<option value="320x240">320x240</option>
<option value="512x384" selected="selected">512x384</option>
<option value="640x360">640x360</option>
<option value="854x480">854x480</option>
<option value="1280x720">1280x720</option>
</select>
</div>
</div></fieldset>
<div class="radio_buttons">
<input type="submit" disabled="disabled" value="" style="display:none" />
</div>
</form></center>
<?php
}
elseif(isset($_POST['type']))
{
$new_format=htmlspecialchars($_POST['type']); // read output format from form
$name=$_SESSION['name'];
//$_SESSION['extension'];
$video_to_convert=$store_dir.$_SESSION['name'].$_SESSION['extension'];
if (isset($_POST['size'])) {$size=$_POST['size'];}
if (isset($_POST['quality'])) {$quality=$_POST['quality'];}
if (isset($_POST['audio'])) {$audio=$_POST['audio'];}
if($new_format=="webm" && $audio=="11025"){$audio="22050";$new_format="webm"; }// for webm and ogg audio can not be 11050
if($new_format=="ogg" && $audio=="11025"){$audio="22050"; $new_format="ogg"; }// for webm and ogg audio can not be 11050
$_SESSION['type']=$new_format;
if($new_format=="flv"){ $call=$ffmpeg." -i ".$video_to_convert." -vcodec flv -f flv -r 30 -b ".$quality."-ab 128000 -ar".$audio." -s ".$size." ".$converted_vids.$name.".".$new_format." -y 2> log/".$name.".txt";}
if($new_format=="avi"){ $call=$ffmpeg." -i ".$video_to_convert." -vcodec mjpeg -f avi -acodec libmp3lame -b ".$quality." -s ".$size." -r 30 -g 12 -qmin 3 -qmax 13 -ab 224 -ar ".$audio." -ac 2 ".$converted_vids.$name.".".$new_format." -y 2> log/".$name.".txt";}
if($new_format=="mp3"){ $call=$ffmpeg." -i ".$video_to_convert." -vn -acodec libmp3lame -ac 2 -ab 128000 -ar ".$audio." ".$converted_vids.$name.".".$new_format." -y 2> log/".$name.".txt";}
if($new_format=="mp4"){ $call=$ffmpeg." -i ".$video_to_convert." -vf logo.png -vcodec mpeg4 -r 30 -b ".$quality." -acodec libmp3lame -ab 126000 -ar ".$audio." -ac 2 -s ".$size." ".$converted_vids.$name.".".$new_format." -y 2> log/".$name.".txt";}
if($new_format=="wmv"){ $call=$ffmpeg." -i ".$video_to_convert." -vcodec wmv1 -r 30 -b ".$quality." -acodec wmav2 -ab 128000 -ar ".$audio." -ac 2 -s ".$size." ".$converted_vids.$name.".".$new_format." -y 2> log/".$name.".txt";}
if($new_format=="ogg"){ $call=$ffmpeg." -i ".$video_to_convert." -vcodec libtheora -r 30 -b ".$quality." -acodec libvorbis -ab 128000 -ar ".$audio." -ac 2 -s ".$size." ".$converted_vids.$name.".".$new_format." -y 2> log/".$name.".txt";}
if($new_format=="webm"){ $call=$ffmpeg." -i ".$video_to_convert." -vcodec libvpx -r 30 -b ".$quality." -acodec libvorbis -ab 128000 -ar ".$audio." -ac 2 -s ".$size." ".$converted_vids.$name.".".$new_format." -y 2> log/".$name.".txt";}
/* START CONVERTING The Video */
require_once("includes/ffmpeg_cmd.php");
$convert = (popen($convert_call, "r"));
pclose($convert);
flush();
// define sessions
$_SESSION['dest_file']=$converted_vids.$name.".".$new_format;
echo "<code class="echappe-js"><script>\n";<br />
echo "counter = 5\n";<br />
echo "var redirect = 0; \n";<br />
echo "$(document).ready(function()\n";<br />
echo "{\n";<br />
echo "var refreshId = setInterval(function() \n";<br />
echo "{\n";<br />
echo "if(redirect == 0) \n { \n";<br />
echo "$('#timeval').load('progress_bar.php');\n";<br />
echo "}\n";<br />
echo "else \n";<br />
echo "{\n";<br />
echo "$('#timeval').load('progress_bar.php?counter='+ counter--);\n";<br />
echo "}\n";<br />
echo "}, 1000);\n";<br />
echo "});\n"; <br />
echo "</script>\n" ;
//
/************************* for debug *************************************
echo "" ; print_r ($_SESSION) ; echo "
" ; **********************************************************************************/
?>
< ?php
else if(isset($_GET[’finished’]))
echo "" ; if(!isset($_SESSION[’name’])) echo "please convert new video" ;include("templates/footer.php") ; ;exit ; $filepath=$converted_vids."./".$_SESSION[’name’].".".$_SESSION[’type’] ; require_once"video_duration.php" ;
$_SESSION[’duration’]=$hours." :".$minutes." :".$seconds ;
$vid_name=$_SESSION[’name’] ;
$vid_src=$_SESSION[’extension’] ;
$vid_new=$_SESSION[’type’] ;
if (isset($_SESSION[’duration’])) $duration=$_SESSION[’duration’] ;else $duration="unknown" ;
if(file_exists($converted_vids.$vid_name.".".$vid_new))
$vid_size=get_size($converted_vids.$vid_name.".".$vid_new) ;
else $vid_size=0 ;?>
your video informationVideo duration < ?php echo $hours." :".$minutes." :".$seconds ; ?> original video name < ?php if(isset($_SESSION[’original_name’]))echo $_SESSION[’original_name’] ; ?> video size < ?php echo $vid_size." MB
" ; ?>source extension < ?php echo str_replace(".","","$vid_src") ; ?> new extension < ?php echo $vid_new ; ?> < ?php
echo "
" ;
session_unset() ;
else
?><script type="text/javascript"><br />
// Convert divs to queue widgets when the DOM is ready<br />
$(function() {<br />
$("#uploader").pluploadQueue({<br />
// General settings<br />
runtimes : 'flash',<br />
url : 'upload.php',<br />
max_file_size : '&lt;?php echo $max_file_size ;?>mb',<br />
chunk_size : '1mb',<br />
unique_names : true,<br />
<br />
// Resize images on clientside if we can<br />
resize : {width : 320, height : 240, quality : 90},<br />
init : {<br />
FilesAdded: function(up, files) {<br />
plupload.each(files, function(file) {<br />
if (up.files.length > 1) {<br />
up.removeFile(file);<br />
}<br />
});<br />
if (up.files.length >= 1) {<br />
$('#pickfiles').hide('slow');<br />
}<br />
},<br />
FilesRemoved: function(up, files) {<br />
if (up.files.length < 1) {<br />
$('#pickfiles').fadeIn('slow');<br />
}<br />
}<br />
},<br />
multi_selection: false,<br />
// Specify what files to browse for<br />
filters : [<br />
{title : "Video files", extensions : "&lt;?php foreach ($allowedExtensions as $value) { echo $value . ","; }?>"}<br />
<br />
],<br />
<br />
// Flash settings<br />
flash_swf_url : 'js/plupload.flash.swf',<br />
<br />
// Silverlight settings<br />
silverlight_xap_url : 'js/plupload.silverlight.xap'<br />
});<br />
<br />
// Client side form validation<br />
$('form').submit(function(e) {<br />
var uploader = $('#uploader').pluploadQueue();<br />
<br />
// Files in queue upload them first<br />
if (uploader.files.length > 0) {<br />
// When all files are uploaded submit form<br />
uploader.bind('StateChanged', function() {<br />
if (uploader.files.length === (uploader.total.uploaded + uploader.total.failed)) {<br />
$('form')[0].submit();<br />
}<br />
});<br />
<br />
uploader.start();<br />
} else {<br />
alert('You must queue at least one video.');<br />
}<br />
<br />
return false;<br />
});<br />
});<br />
</script>Maximum upload size < ?php echo $max_file_size ; ?> MB
< ?php include("templates/info.php") ; ?>
< ?php
//End Body Area/
?>