
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (15)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...) -
Other interesting software
13 avril 2011, parWe don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
We don’t know them, we didn’t try them, but you can take a peek.
Videopress
Website : http://videopress.com/
License : GNU/GPL v2
Source code : (...)
Sur d’autres sites (2759)
-
Killing all child processes
12 juin 2016, par ErraticFoxI have written a onclick function that runs child process for a command line for ffmpeg. Though I can’t seem to force close or kill the process in the middle of it. I’ve tried multiple ways such as child.kill() along with
SIGINT
,SIGKILL
,SIGHUP
,SIGQUIT
, andSIGTERM
and it continuously runs in the background still until finished or killed in the task manager. So how can I kill all the process related to the exec ?Here’s my current code :
function submitBtn() {
var selectVal1 = $("#inputFile1 option:selected").val(),
selectVal2 = $("#inputFile2 option:selected").val(),
selectOpt2 = $("#inputFile2 option:selected").text().toLowerCase()
if (!selectVal1 || !selectVal2) {
Materialize.toast('Please select your formats', 4000)
} else if ($("#uploadFile").val() === '') {
Materialize.toast('Please select your file', 4000)
} else {
var process = require("child_process")
var inputDir = uploadFile.files[0].path
var dir = inputDir.split("\\")
var pop = dir.pop()
var outputDir = dir.join("\\")
var cmd = `ffmpeg -y -i "${inputDir}" "${outputDir}\\output.${selectOpt2}"`
$("#load").removeClass("disabledLoad")
func = process.exec(cmd, function(error, stdout, stderr) {})
func.on('exit', function() {
$("document").ready(function() {
$("#load").addClass("disabledLoad")
Materialize.toast('Conversion compelete!', 4000)
})
})
}
}
function exitBtn() {
//var remote = require('electron').remote
//var window = remote.getCurrentWindow()
//window.close()
func.kill()
}I even tried renaming
process
toproc
and then doingprocess.on('exit', function () {
console.log('process is about to exit, kill ffmpeg');
func.kill()
})in exitBtn but still nothing. It doesn’t give errors or log my string I put.
-
Capture desktop with gdigrab and save the result to video file using ffmpeg and C++
13 mai 2019, par SkunzI’m building a C++ application that is able to capture the screen and save the output to a file (.mkv, .mp4, doesn’t matter).
I tried to switch codecs and played with the AVCodecContext settings. When subsitute the gdi capture with reading from a static .mp4 file everything works fine.
Here is my gdigrab initalization.
_inputFormat = av_find_input_format("gdigrab");
if (!_inputFormat) {
std::cout << "Unable to open input Format" << std::endl;
exit(1);
}
if (avformat_open_input(&_screenFormatContext, "desktop", _inputFormat, &_recordOptions) < 0) {
std::cout << "Unable to open input stream" << std::endl;
exit(1);
}
if (avformat_find_stream_info(_screenFormatContext, &_recordOptions) < 0) {
std::cout << "Couldn't find input stream" << std::endl;
exit(1);
}
av_dump_format(_screenFormatContext, 0, "GDI Capture", 0);
for (int i = 0; i < _screenFormatContext->nb_streams; i++) {
if (_screenFormatContext->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
_videoStreamIdx = i;
break;
}
}
if (_videoStreamIdx == -1) {
std::cout << "Unable to find video Stream" << std::endl;
exit(1);
}
_codecPar = _screenFormatContext->streams[_videoStreamIdx]->codecpar;Here is my setup code for the encoder and decoder.
/*
Decoder
*/
_dCodec = avcodec_find_decoder(_codecPar->codec_id);
if (!_dCodec) {
std::cout << "Unable to find decoder" << std::endl;
exit(1);
}
_dCodecContext = avcodec_alloc_context3(_dCodec);
if (avcodec_parameters_to_context(_dCodecContext, _codecPar) < 0) {
std::cout << "Unable to copy context" << std::endl;
exit(1);
}
if (avcodec_open2(_dCodecContext, _dCodec, NULL) < 0) {
std::cout << "Unable to open dCodec" << std::endl;
exit(1);
}
/*
Encoder
*/
_eCodec = avcodec_find_encoder(AV_CODEC_ID_H265);
if (!_eCodec) {
std::cout << "Unable to find encoder" << std::endl;
exit(1);
}
_eCodecContext = avcodec_alloc_context3(_eCodec);
//width and height have to be divisible by 2
if (_codecPar->width % 2 != 0)
_codecPar->width--;
if (_codecPar->height % 2 != 0)
_codecPar->height--;
_eCodecContext->pix_fmt = AV_PIX_FMT_YUV422P;
_eCodecContext->width = _codecPar->width;
_eCodecContext->height = _codecPar->height;
_eCodecContext->gop_size = 10;
_eCodecContext->max_b_frames = 1;
_eCodecContext->time_base.den = 30;
_eCodecContext->time_base.num = 1;
if (avcodec_open2(_eCodecContext, _eCodec, NULL) < 0) {
std::cout << "Unable to open eCodec" << std::endl;
exit(1);
}Here is my main loop. Grabbing the packets from gdi, decoding them and encoding them.
while (av_read_frame(_screenFormatContext, _pkt) == 0) {
if (_pkt->stream_index == _videoStreamIdx) {
if (_decodePacket() < 0)
exit(1);
_encodeFrame();
}
av_packet_unref(_pkt);
}And here the encoding/decoding functions
int ScreenRecorder::_decodePacket(void)
{
//send packet to decoder
int ret = avcodec_send_packet(_dCodecContext, _pkt);
if (ret < 0) {
std::cout << "error while sending packet to decoder" << std::endl;
return ret;
}
ret = avcodec_receive_frame(_dCodecContext, _frame);
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
return 0;
//Was there an error?
else if (ret < 0) {
std::cout << "Error with receiving frame" << std::endl;
exit(1);
}
//No errors -> got frame
std::cout << "Got frame " << _dCodecContext->frame_number << " with size " << _frame->pkt_size << std::endl;
char frame_filename[1024];
snprintf(frame_filename, sizeof(frame_filename), "%s-%d.pgm", "frame", _dCodecContext->frame_number);
//_saveGrayFrame(_frame->data[0], _frame->linesize[0], _frame->width, _frame->height, frame_filename);
return 0;
}
void ScreenRecorder::_encodeFrame(void)
{
AVPacket* pkt = av_packet_alloc();
// send frame to encoder - 0 on success
int ret = avcodec_send_frame(_eCodecContext, _frame);
if (ret < 0) {
std::cerr << "Unable to send frame! ERRORCODE: " << ret << std::endl;
exit(1);
}
while (ret == 0) {
ret = avcodec_receive_packet(_eCodecContext, pkt);
//Do I need to send more packets?
if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
std::cout << "Needing one more packet " << std::endl;
av_packet_unref(pkt);
return ;
}
//Was there an error?
else if (ret < 0) {
std::cout << "Error with receiving packet" << std::endl;
exit(1);
}
//No errors -> got packet
std::cout << "Got packet " << pkt->pts << " of size " << pkt->size << std::endl;
if (av_write_frame(_outFormatContext, pkt) < 0) {
std::cout << "Unable to write frame" << std::endl;
exit(1);
}
av_packet_unref(pkt);
}
}In case you still need the header file
#ifndef SCREENRECORDER_HPP
# define SCREENRECORDER_HPP
extern "C" {
#include "libavcodec/avcodec.h"
#include "libavdevice/avdevice.h"
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
}
class ScreenRecorder
{
private:
AVCodecContext *_dCodecContext;
AVCodecContext *_eCodecContext;
AVFormatContext *_fileFormatContext;
AVFormatContext *_screenFormatContext;
AVFormatContext *_outFormatContext;
AVInputFormat *_inputFormat;
AVCodecParameters *_codecPar;
AVStream *_videoTrack;
AVCodec *_dCodec;
AVCodec *_eCodec;
AVFrame *_frame;
AVPacket *_pkt;
AVDictionary *_options;
AVDictionary *_recordOptions;
int _videoStreamIdx;
int _decodePacket(void);
void _encodeFrame(void);
void _openInputFile(void);
void _initalizeCodec(void);
void _initalizeOutputFile(void);
void _closeCodec(void);
void _initalizeGDI(void);
void _saveGrayFrame(unsigned char* buf, int wrap, int xsize, int ysize, char* filename);
public:
ScreenRecorder();
~ScreenRecorder();
void start();
};
#endifWhen I run my code I am getting Exception thrown at 0x00007FF819864A80 (msvcrt.dll) in Streaming.exe : 0xC0000005 : Access violation reading location 0x0000000000000EF0.
It comes from avcodec_send_frame function. Seems like I’m trying to access memory that wasn’t allocated.
I am new to the ffmpeg lib and hope that someone can get me on the right track. Thank you very much. If you have any questions please ask them. -
Can't call FFMPEG from CMD after installing chocolatey+ffmpeg on windows docker container
19 novembre 2022, par Adil Abdul RahmanI have a C# code that is dependent on FFMPEG via CMD/powershell. I am trying to run CLI ffmpeg via a C# code in a windows container with sdk:6.0-windowsservercore-ltsc2022. I found this guide(use 12ft.io to bypass paywall) that says to install chocolatey and then install ffmpeg through that like so :


USER ContainerAdministrator
EXPOSE 3389/tcp


RUN powershell.exe \
 Set-ExecutionPolicy Bypass -Scope Process -Force; \
 iwr -Uri 'https://community.chocolatey.org/install.ps1' -UseBasicParsing -OutFile $home/choco_install.ps1; \
 powershell $home/choco_install.ps1; \
 del $home/choco_install.ps1; \
 choco; \
 exit 0;
 
RUN powershell.exe \
 powershell choco install chocolatey-compatibility.extension -y --force; \
 powershell choco install chocolatey-core.extension -y --force; \
 powershell choco install ffmpeg-full -y --force; \
 ffmpeg; \
 exit 0;



( I am using this guide for C# dockerfile )


And my C# Code :


string command = $"/C ffmpeg -i \"{VideoUri}\" -vn -ac 1 {outputName}.mp3";
Process.Start("cmd.exe", command).WaitForExit();



But I am running into some trouble. My C# code throws this error :


'ffmpeg' is not recognized as an internal or external command, operable program or batch file.


I have tried calling FFMPEG from the dockerfile to test if it has installed but it just returns this :


Step 5/17 : RUN powershell.exe powershell choco install chocolatey-compatibility.extension -y --force; powershell choco install chocolatey-core.extension -y --force; powershell choco install ffmpeg-full -y --force; ffmpeg; exit 0;
 ---> Using cache
 ---> 83b2941d03e6