
Recherche avancée
Médias (91)
-
999,999
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Demon seed (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
The four of us are dying (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Corona radiata (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Lights in the sky (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
Autres articles (28)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Que fait exactement ce script ?
18 janvier 2011, parCe script est écrit en bash. Il est donc facilement utilisable sur n’importe quel serveur.
Il n’est compatible qu’avec une liste de distributions précises (voir Liste des distributions compatibles).
Installation de dépendances de MediaSPIP
Son rôle principal est d’installer l’ensemble des dépendances logicielles nécessaires coté serveur à savoir :
Les outils de base pour pouvoir installer le reste des dépendances Les outils de développements : build-essential (via APT depuis les dépôts officiels) ; (...)
Sur d’autres sites (5180)
-
Encoding H.264 video using FFmpeg C API
18 juillet 2014, par GummiBI’m trying to encode a H.264 video with the FFMPEG C API.
I have successfully compiled and executed the decoding/encoding example provided by FFMPEG.The problem I’m facing is that the .mpg file (encoded with AV_CODEC_ID_MPEG1VIDEO) the example creates works. Windows creates a thumbnail and everything. On the other hand the .h264 (encoded with AV_CODEC_ID_H264) file does not. When I try to play the file in VLC the play/pause button just flickers, no thumbnail in windows, no nothing.
During encoding libx264 reports the following :
[libx264 @ 004b81a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 004b81a0] profile High, level 1.3
[libx264 @ 004b81a0] frame I:3 Avg QP:26.79 size: 2116
[libx264 @ 004b81a0] frame P:12 Avg QP:26.60 size: 789
[libx264 @ 004b81a0] frame B:10 Avg QP:31.39 size: 499
[libx264 @ 004b81a0] consecutive B-frames: 20.0% 80.0%
[libx264 @ 004b81a0] mb I I16..4: 78.3% 11.6% 10.1%
[libx264 @ 004b81a0] mb P I16..4: 77.4% 0.6% 0.1% P16..4: 20.3% 0.7% 0.9% 0.0% 0.0% skip: 0.0%
[libx264 @ 004b81a0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 9.4% 0.2% 0.0% direct:11.0% skip:79.4% L0:25.4% L1:35.4% BI:39.2%
[libx264 @ 004b81a0] final ratefactor: 17.03
[libx264 @ 004b81a0] 8x8 transform intra:3.4% inter:31.3%
[libx264 @ 004b81a0] direct mvs spatial:0.0% temporal:100.0%
[libx264 @ 004b81a0] coded y,uvDC,uvAC intra: 4.4% 35.8% 1.6% inter: 1.3% 34.5% 9.5%
[libx264 @ 004b81a0] i16 v,h,dc,p: 0% 0% 0% 100%
[libx264 @ 004b81a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 7% 20% 17% 49% 0% 0% 0% 1% 6%
[libx264 @ 004b81a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 7% 18% 45% 2% 7% 2% 3% 2%
[libx264 @ 004b81a0] i8c dc,h,v,p: 2% 6% 4% 88%
[libx264 @ 004b81a0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 004b81a0] ref P L0: 95.6% 1.6% 2.2% 0.5% 0.2%
[libx264 @ 004b81a0] ref B L0: 67.5% 28.5% 3.2% 0.8%
[libx264 @ 004b81a0] kb/s:166.45"ffprobe.exe test.h264 -show_streams" returns
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1/50
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=352
height=288
has_b_frames=1
sample_aspect_ratio=0:1
display_aspect_ratio=0:1
pix_fmt=yuv420p
level=13
timecode=N/A
id=N/A
r_frame_rate=50/2
avg_frame_rate=25/1
time_base=1/1200000
start_pts=N/A
start_time=N/A
duration_ts=N/A
duration=N/A
bit_rate=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
[/STREAM]There you can see :
start_time=N/A
duration_ts=N/A
duration=N/AI have tried countless changes to the AVCodecContext and multitude of parameters options to av_opt_set function. Still no luck getting a working H.264 video. I have even tried different builds of FFmpeg. No luck.
I’m using the "FFmpeg git-0fb64da 32-bit Dev" build from Zeranoe and MinGw 4.7.2
-
Revision 18c83b3714 : Compressed/uncompressed frame header changes. Adding API to read/write uncompre
29 mai 2013, par Dmitry KovalevChanged Paths :
Modify /vp9/common/vp9_common.h
Delete /vp9/common/vp9_header.h
Modify /vp9/common/vp9_modecont.h
Modify /vp9/common/vp9_onyxc_int.h
Modify /vp9/decoder/vp9_decodframe.c
Add /vp9/decoder/vp9_read_bit_buffer.h
Modify /vp9/encoder/vp9_bitstream.c
Modify /vp9/encoder/vp9_onyx_if.c
Add /vp9/encoder/vp9_write_bit_buffer.h
Modify /vp9/vp9_common.mk
Modify /vp9/vp9_dx_iface.c
Modify /vp9/vp9cx.mk
Modify /vp9/vp9dx.mk
Compressed/uncompressed frame header changes.Adding API to read/write uncompressed frame header bits (it is not final
yet). Separate functions to read/write uncompressed header. Moving
clr_type, error_resilient_mode, refresh_frame_context,
frame_parallel_decoding_mode, frame_context_idx from compressed partition
to uncompressed frame header.Change-Id : Id3ed8a387980c652ae147549412f4ec24a0a5bd0
-
video proccesing : extract frames and encrypt them then insert them back to the video in java using xuggler
24 juillet 2015, par Anas M. JubaraI’m working on a video encryption application .. the main idea is to input the video file to the application and the application should output it in an encrypted form... am using xuggler library to manipulate the video and get to the frames and AES for encryption.
my code works fine for accessing the frames and encrypting them, what i need help with is how to write the encrypted frame back to the video file to replace the original one without corrupting the video file for the video players.
Here is my codepackage xuggler;
import com.xuggle.mediatool.IMediaReader;
import com.xuggle.mediatool.IMediaWriter;
import com.xuggle.mediatool.MediaListenerAdapter;
import com.xuggle.mediatool.ToolFactory;
import com.xuggle.mediatool.event.IVideoPictureEvent;
import com.xuggle.xuggler.Global;
import com.xuggle.xuggler.ICodec;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Transparency;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.ComponentColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
import java.io.File;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.imageio.ImageIO;
public class DecodeAndCaptureFrames extends MediaListenerAdapter
{
// The number of seconds between frames.
public static final double SECONDS_BETWEEN_FRAMES = 5;
//The number of micro-seconds between frames.
public static final long MICRO_SECONDS_BETWEEN_FRAMES =(long) (Global.DEFAULT_PTS_PER_SECOND * SECONDS_BETWEEN_FRAMES);
// Time of last frame write
private static long mLastPtsWrite = Global.NO_PTS;
private static final double FRAME_RATE = 50;
private static final int SECONDS_TO_RUN_FOR = 20;
private static final String outputFilename = "D:\\K.mp4";
public static IMediaWriter writer = ToolFactory.makeWriter(outputFilename);
//receive BufferedImage and returns its byte data
public static byte[] get_byte_data(BufferedImage image) {
WritableRaster raster = image.getRaster();
DataBufferByte buffer = (DataBufferByte) raster.getDataBuffer();
return buffer.getData();
}
//create new_img with the attributes of image
public static BufferedImage user_space(BufferedImage image) {
//create new_img with the attributes of image
BufferedImage new_img = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
Graphics2D graphics = new_img.createGraphics();
graphics.drawRenderedImage(image, null);
graphics.dispose(); //release all allocated memory for this image
return new_img;
}
public static BufferedImage toImage(byte[] imagebytes, int width, int height) {
DataBuffer buffer = new DataBufferByte(imagebytes, imagebytes.length);
WritableRaster raster = Raster.createInterleavedRaster(buffer, width, height,
3 * width, 3, new int[]{2, 1, 0}, (Point) null);
ColorModel cm = new ComponentColorModel(ColorModel.getRGBdefault().getColorSpace(),
false, true, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
return new BufferedImage(cm, raster, true, null);
}
public static byte[] encrypt(byte[] orgnlbytes, String key) throws NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException {
byte[] encbytes = null;
try {
Cipher cipher = Cipher.getInstance("AES");
KeyGenerator keyGen = KeyGenerator.getInstance("AES");
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
// cryptograph. secure random
random.setSeed(key.getBytes());
keyGen.init(128, random);
// for example
SecretKey secretKey = keyGen.generateKey();
try {
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
} catch (InvalidKeyException ex) {
Logger.getLogger(DecodeAndCaptureFrames.class.getName()).log(Level.SEVERE, null, ex);
}
encbytes = cipher.doFinal(orgnlbytes);
}
catch (NoSuchAlgorithmException ex) {
Logger.getLogger(DecodeAndCaptureFrames.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoSuchPaddingException ex)
{
System.out.print("can not encrypt buffer");
}
return encbytes;
}
/**
* The video stream index, used to ensure we display frames from one
* and only one video stream from the media container.
*/
private int mVideoStreamIndex = -1;
/**
* Takes a media container (file) as the first argument, opens it and
* writes some of it's video frames to PNG image files in the
* temporary directory.
*
* @param args must contain one string which represents a filename
*/
public static void main(String[] args)
{
// create a new mr. decode and capture frames
DecodeAndCaptureFrames decodeAndCaptureFrames;
decodeAndCaptureFrames = new DecodeAndCaptureFrames("D:\\K.mp4");
}
/** Construct a DecodeAndCaptureFrames which reads and captures
* frames from a video file.
*
* @param filename the name of the media file to read
*/
//makes reader to the file and read the data of it
public DecodeAndCaptureFrames(String filename)
{
// create a media reader for processing video
IMediaReader reader = ToolFactory.makeReader(filename);
// stipulate that we want BufferedImages created in BGR 24bit color space
reader.setBufferedImageTypeToGenerate(BufferedImage.TYPE_3BYTE_BGR);
// note that DecodeAndCaptureFrames is derived from
// MediaReader.ListenerAdapter and thus may be added as a listener
// to the MediaReader. DecodeAndCaptureFrames implements
// onVideoPicture().
reader.addListener(this);
// read out the contents of the media file, note that nothing else
// happens here. action happens in the onVideoPicture() method
// which is called when complete video pictures are extracted from
// the media source
while (reader.readPacket() == null)
do {} while(false);
}
/**
* Called after a video frame has been decoded from a media stream.
* Optionally a BufferedImage version of the frame may be passed
* if the calling {@link IMediaReader} instance was configured to
* create BufferedImages.
*
* This method blocks, so return quickly.
*/
public void onVideoPicture(IVideoPictureEvent event)
{
try
{
// if the stream index does not match the selected stream index,
// then have a closer look
if (event.getStreamIndex() != mVideoStreamIndex)
{
// if the selected video stream id is not yet set, go ahead an
// select this lucky video stream
if (-1 == mVideoStreamIndex)
mVideoStreamIndex = event.getStreamIndex();
// otherwise return, no need to show frames from this video stream
else
return;
}
// if uninitialized, backdate mLastPtsWrite so we get the very
// first frame
if (mLastPtsWrite == Global.NO_PTS)
mLastPtsWrite = event.getTimeStamp() - MICRO_SECONDS_BETWEEN_FRAMES;
// if it's time to write the next frame
if (event.getTimeStamp() - mLastPtsWrite >= MICRO_SECONDS_BETWEEN_FRAMES)
{
// Make a temporary file name
// File file = File.createTempFile("frame", ".jpeg");
// write out PNG
// ImageIO.write(event.getImage(), "png", file);
BufferedImage orgnlimage = event.getImage();
orgnlimage = user_space(orgnlimage);
byte[] orgnlimagebytes = get_byte_data(orgnlimage);
byte[] encryptedbytes = encrypt(orgnlimagebytes, "abc");
BufferedImage encryptedimage = toImage(encryptedbytes, orgnlimage.getWidth(), orgnlimage.getHeight());
ImageIO.write(encryptedimage, "png", File.createTempFile("frame", ".png"));
// indicate file written
double seconds = ((double)event.getTimeStamp())
/ Global.DEFAULT_PTS_PER_SECOND;
// System.out.printf("at elapsed time of %6.3f seconds wrote: %s\n",seconds, file);
// update last write time
mLastPtsWrite += MICRO_SECONDS_BETWEEN_FRAMES;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}