
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (21)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Contribute to documentation
13 avril 2011Documentation is vital to the development of improved technical capabilities.
MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
To contribute, register to the project users’ mailing (...) -
Selection of projects using MediaSPIP
2 mai 2011, parThe examples below are representative elements of MediaSPIP specific uses for specific projects.
MediaSPIP farm @ Infini
The non profit organizationInfini develops hospitality activities, internet access point, training, realizing innovative projects in the field of information and communication technologies and Communication, and hosting of websites. It plays a unique and prominent role in the Brest (France) area, at the national level, among the half-dozen such association. Its members (...)
Sur d’autres sites (6647)
-
Access violation reading location 0x000000148965F000
14 février 2014, par user3012914I tried to encode BMP Images, which i get from a buffer and store it as a H264 Video. I am stuck with these errors the arrive randomly and repeatedly
I am using Visual Studio 2012
1) Access violation reading location 0x000000148965F000.
2)Heap corruption
The debug shows the error at this point
struct SwsContext* fooContext = sws_getContext(_imgWidth,_imgHeight,PIX_FMT_RGB32,c->width,c->height,PIX_FMT_YUV420P, SWS_FAST_BILINEAR,NULL,NULL,NULL);
sws_scale(fooContext, inpic->data, inpic->linesize, 0, c->height, outpic->data, outpic->linesize); // converting frame size and formatI guess the read violation happens due to non - pre initialized values. But i couldnt exactly understand why. I have also attached part of the code below
PagedImage *inImg = getUpdatedInputImage(0);
ML_CHECK(inImg);
ImageVector imgExt = inImg->getImageExtent();
if ((imgExt.x == _imgWidth) && (imgExt.y == _imgHeight))
{
if (((imgExt.x % 4) == 0) && ((imgExt.y % 4) == 0))
{
_numFramesFld->setIntValue(_numFramesFld->getIntValue() + 1);
MLFree(unicodeFilename);
// configure header
//BITMAPINFO bitmapInfo
// read out input image and write output image into video
// get input image as an array
void* imgData = NULL;
SubImageBox imageBox(imgExt); // get the whole image
getTile(inImg, imageBox, MLuint8Type, &imgData);
MLuint8* iData = (MLuint8*)imgData;
// since we have only images with
// a z-ext of 1, we can compute the c stride as follows
int cStride = _imgWidth * _imgHeight;
int offset = 0;
MLuint8 r=0, g=0, b=0;
// pointer into the bitmap that is
// used to write images into an video
UCHAR* dst = (UCHAR*)_bits;
for (int y = _imgHeight-1; y >= 0; y--)
{ // reversely scan the image. if y-rows of DIB are set in normal order, no compression will be available.
offset = _imgWidth * y;
for (int x = 0; x < _imgWidth; x++)
{
if (_isGreyValueImage)
{
r = iData[offset + x];
*dst++ = (UCHAR)r;
*dst++ = (UCHAR)r;
*dst++ = (UCHAR)r;
}
else
{
b = iData[offset + x]; // windows bitmap need reverse order: bgr instead of rgb
g = iData[offset + x + cStride ];
r = iData[offset + x + cStride + cStride];
*dst++ = (UCHAR)r;
*dst++ = (UCHAR)g;
*dst++ = (UCHAR)b;
}
// alpha channel in input image is ignored
}
}
outbuf_size = 100000 + c->width*c->height*(32>>3); // allocate output buffer
outbuf = static_cast(malloc(outbuf_size));
fileName_ = (_outputFilenameFld->getStringValue()).c_str();
FILE* f = fopen(fileName_,"wb"); // opening video file for writing
if(!f)
{
_messageFld->setStringValue("Cannot open file");
}
else _messageFld->setStringValue("Opened video file for writing\n");
//for(i=0;i<_numFramesFld->getIntValue();i++)
//{
fflush(stdout);
int nbytes = avpicture_get_size(PIX_FMT_YUV420P, c->width, c->height); // allocating outbuffer
uint8_t* outbuffer = (uint8_t*)av_malloc(nbytes*sizeof(uint8_t));
AVFrame* inpic = avcodec_alloc_frame(); // mandatory frame allocation
AVFrame* outpic = avcodec_alloc_frame();
//outpic->pts = (int64_t)((float)i * (1000.0/((float)(c->time_base.den))) * 90); // setting frame pts
avpicture_fill((AVPicture*)inpic,(uint8_t*)dst, PIX_FMT_RGB32, c->width, c->height); // fill image with input screenshot
avpicture_fill((AVPicture*)outpic, outbuffer, PIX_FMT_YUV420P, c->width, c->height); // clear output picture for buffer copy
av_image_alloc(outpic->data, outpic->linesize, c->width, c->height, c->pix_fmt, 1);
inpic->data[0] += inpic->linesize[0]*(c->height-1); // flipping frame
inpic->linesize[0] = -inpic->linesize[0]; // flipping frame
struct SwsContext* fooContext = sws_getContext(_imgWidth,_imgHeight,PIX_FMT_RGB32,c->width,c->height,PIX_FMT_YUV420P, SWS_FAST_BILINEAR,NULL,NULL,NULL);
sws_scale(fooContext, inpic->data, inpic->linesize, 0, c->height, outpic->data, outpic->linesize); // converting frame size and format
out_size = avcodec_encode_video(c, outbuf, outbuf_size, outpic); // encoding video
_messageFld->setStringValue("Encoding frame %3d (size=%5d)\n");
fwrite(outbuf, 1, out_size, f);
delete [] dst; // freeing memory
av_free(outbuffer);
av_free(inpic);
av_free(outpic);
av_free(fooContext);
DeleteObject(_hbitmap);
for(int Z = 0; Z/ encode the delayed frames
fwrite(outbuf, 1, out_size, f);
}
//outbuf[0] = 0x00;
//outbuf[1] = 0x00; // add sequence end code to have a real mpeg file
//outbuf[2] = 0x01;
//outbuf[3] = 0xb7;
//fwrite(outbuf, 1, 4, f);
fclose(f);
avcodec_close(c); // freeing memory
free(outbuf);
av_free(c);
printf("Closed codec and Freed\n");
}
} -
Change ffmpeg output directory
6 mai 2019, par FilipIm using ffmpeg to compress footage and i want to compess the footage of a specific day but when i overwrite the files it outputs a empty stream because it writes as it reads at the same time so i want to rename the output file. Find will give the full path which is necessary but i don’t know how to change the actual file name, rather than the path.
Any suggestions ?
find /home/server/recordings/compress -name '*.mp4' -print0 | xargs -0 -I{} ffmpeg -i {} -c:v libx265 -preset fast -crf 25 -x265-params "vbv-maxrate=1500:vbv-bufsize=1000" -c:a aac {}
-
Why does my lambda doesn't end with an expected request end event ? [on hold]
16 avril 2019, par Nachum Freedmanconst now = (...a) =>
console.log(...a, Math.floor(new Date().getTime() / 1000) % 3600);
exports.handler = (event, context, callback) => {
console.log("PROCESS START");
const FROM_BUCKET = event.Records[0].s3.bucket.name;
const Key = decodeURIComponent(
event.Records[0].s3.object.key.replace(/\+/g, " ")
);
const uploadKey = Key.replace(/.webm/, ".mp4");
console.log("FROM BUCKET", FROM_BUCKET);
console.log("Recived key", Key);
const slicedFilename = Key.slice(-4) !== "webm" ? Key.slice(-4) : ".webm";
const extension =
slicedFilename === ".mp4"
? ".mp4"
: slicedFilename === ".pcm"
? ".pcm"
: slicedFilename === ".webm"
? ".webm"
: console.log("THE FILE NAME IS INCORRECT PLEASE CHECK @:", Key);
console.log("Extension detected is", extension);
const downloadKey =
Key.slice(-4) !== "webm"
? Key.slice(0, -4) + extension
: Key.slice(0, -5) + extension;
const downloadParams = { Bucket: FROM_BUCKET, Key: downloadKey };
console.log("Downloading file from S3", downloadParams);
const mobileDownloadExtension =
extension === ".mp4" ? ".pcm" : extension === ".pcm" ? ".mp4" : null;
const mobileDownloadParams = {
Bucket: FROM_BUCKET,
Key: Key.slice(0, -4) + mobileDownloadExtension
};
console.log("Downloading file from S3", mobileDownloadParams);
const tmpNamespace = Math.random();
const isMobile = extension === ".mp4" || extension === ".pcm";
let firstDigit = 0;
let restOfTheOffset = 0;
if (isMobile) {
console.log(
"If apply, second key to download is a file type",
mobileDownloadExtension
);
const offsetTime = Key.slice(
Key.lastIndexOf("_") + 1,
Key.indexOf(".")
).replace("-", "");
if (offsetTime > 999) {
firstDigit = 1;
restOfTheOffset = offsetTime.slice(1, offsetTime.length);
} else {
firstDigit = 0;
restOfTheOffset = offsetTime;
}
}
console.log("FIle recieved from Mobile?", isMobile);
Promise.all([
// download file from s3
new Promise((resolve, reject) =>
s3.getObject(downloadParams, (err, response) => {
if (err) {
console.error(
"Error while downloading file from S3",
downloadParams,
err.code,
"-",
err.message
);
return reject(err);
}
console.log("Successfully downloaed file from S3", downloadParams);
fs.writeFile(
tmp + "/input" + tmpNamespace + extension,
response.Body,
err =>
err
? console.log(err.code, "-", err.message) || reject(err)
: console.log(tmp + "/input" + tmpNamespace + extension) ||
resolve()
);
})
),
new Promise((resolve, reject) => {
extension !== ".mp4" && extension !== ".pcm"
? resolve()
: s3.getObject(mobileDownloadParams, (err, response) => {
if (err) {
console.error(
"Error while downloading file from S3",
mobileDownloadParams,
err.code,
"-",
err.message
);
return reject(err);
}
console.log(
"Successfully downloaed file from S3",
mobileDownloadParams
);
fs.writeFile(
tmp + "/input" + tmpNamespace + mobileDownloadExtension,
response.Body,
err =>
err
? console.log(err.code, "-", err.message) || reject(err)
: console.log(
tmp + "/input" + tmpNamespace + mobileDownloadExtension
) || resolve()
);
});
})
])
.then(() =>
Promise.all([
// call the answerVideoReady -> PROCESSING mobileDownloadExtnesion is actually the second file we seek (if mp4 then pcm)
// ,
isMobile
? Promise.resolve()
.then(() => {
new Promise((resolve, reject) => {
console.log("CALLING VIDEO PROCESSING", Key);
videoProcessing(Key);
resolve();
});
})
.then(
() =>
// run ffmpeg
// ffmpeg -i tmp/input.mp4 -movflags faststart -acodec copy -vcodec copy output.mp4
now("FFMPEG CONVERT PCM TO WAV START") ||
new Promise((resolve, reject) =>
spawn("./ffmpeg/ffmpeg", [
"-f",
"s16le",
"-ar",
"16000",
"-ac",
"1",
"-i",
tmp + "/input" + tmpNamespace + ".pcm",
"-ar",
"44100",
"-ac",
"2",
tmp + "/input" + tmpNamespace + ".wav"
]).on("close", code =>
console.log("FFMPEG CONVERT PCM TO WAV SUCCESS", code) ||
!code
? resolve()
: reject()
)
)
)
.then(
() =>
// run ffmpeg
// ffmpeg -i tmp/input.mp4 -movflags faststart -acodec copy -vcodec copy output.mp4
//more stuff
now("FFMPEG COMBINE MP4 AND WAV START") ||
new Promise(
(resolve, reject) =>
console.log(
[
"-i",
tmp + "/input" + tmpNamespace + ".mp4",
"-itsoffset",
"-" + firstDigit + "." + restOfTheOffset,
"-i",
tmp + "/input" + tmpNamespace + ".wav",
"-movflags",
"faststart",
"-filter_complex",
" [1:0] apad ",
"-shortest",
tmp + "/output" + tmpNamespace + ".mp4"
].join(" ")
) ||
spawn("./ffmpeg/ffmpeg", [
"-i",
tmp + "/input" + tmpNamespace + ".mp4",
"-itsoffset",
"-" + firstDigit + "." + restOfTheOffset,
"-i",
tmp + "/input" + tmpNamespace + ".wav",
"-movflags",
"faststart",
"-filter_complex",
" [1:0] apad ",
"-shortest",
tmp + "/output" + tmpNamespace + ".mp4"
]).on("close", code =>
console.log(
"FFMPEG COMBINE MP4 AND WAV SUCCESS",
code
) || !code
? resolve()
: reject()
)
)
)
: Promise.resolve()
.then(() => {
new Promise((resolve, reject) => {
console.log("CALLING VIDEO PROCESSING", Key);
videoProcessing(Key);
resolve();
});
})
.then(
() =>
now("FFMPEG SEND WEBM START") ||
new Promise((resolve, reject) => {
exec(
"./sed -i '1,4d;$d' " +
tmp +
"/input" +
tmpNamespace +
".webm"
).on(
"close",
code =>
console.log("FFMPEG SEND WEBM SUCCESS", code) ||
(!code ? resolve() : reject())
);
})
)
.then(
() =>
// run ffmpeg
// ffmpeg -i tmp/input.mp4 -movflags faststart -acodec copy -vcodec copy output.mp4
now("FFMPEG WEBM WEB READY START") ||
new Promise((resolve, reject) =>
(a => {
a.stdout.on("data", data => {
//console.log(`child stdout:\n${data}`);
});
a.stderr.on("data", data => {
//console.log(`child stdout:\n${data}`);
});
return a;
})(
spawn("./ffmpeg/ffmpeg", [
"-i",
tmp + "/input" + tmpNamespace + extension,
"-movflags",
"faststart",
"-acodec",
"aac",
"-vcodec",
"h264",
"-preset",
"slow",
"-crf",
"26",
"-r",
"25",
tmp + "/output" + tmpNamespace + ".mp4"
])
).on("close", code =>
console.log(
"FFMPEG WEBM WEB READY FINISHED WITH:",
code
) || !code
? resolve()
: reject()
)
)
)
])
)
.then(
() =>
new Promise((resolve, reject) =>
// upload the output.mp4 to s3
fs.readFile(
tmp + "/output" + tmpNamespace + ".mp4",
(err, filedata) => {
if (err) {
console.log("ERROR WHILE TRYING TO READ FILE", err);
throw err;
}
console.log("KEEEEYYY", uploadKey),
s3.putObject(
{
Bucket: TO_BUCKET,
Key: uploadKey,
Body: filedata
},
(err, response) => {
console.log(response);
if (err) {
console.log(
"ERROR WHILE UPLOADING FILE TO S3",
err,
response
);
return reject(err);
}
//uploading file
console.log(
"Successfully uploaded file to " + TO_BUCKET,
Key
);
resolve();
}
);
}
)
)
// call the answerVideoReady -> COMPLETED, context.success or ERROR, context.fail or error on set status to ERROR -> fail
)
.then(p =>
videoCompleted(Key)
.then(c => context.succeed())
.catch(es => context.fail(es))
)
.catch(
e =>
console.log("catch for upload error with:", e) ||
videoError(Key)
.then(p => context.fail(e))
.catch(ee => context.fail(ee))
);
};