
Recherche avancée
Autres articles (79)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Encoding and processing into web-friendly formats
13 avril 2011, parMediaSPIP automatically converts uploaded files to internet-compatible formats.
Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
All uploaded files are stored online in their original format, so you can (...) -
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...)
Sur d’autres sites (8996)
-
How do I force an IDR-frame using the x264 C API ?
28 octobre 2020, par KeithI am attempting to use an external bool signal to force the next encoded frame to be an IDR-frame using the x264 C API. I am using the "baseline" profile with the "ultrafast" and "zerolatency" presets. I tried to use the input pic settings prior to encoding, as in this code snippet, but this has not worked. My class Open() and Encode() methods are shown here. Any help will be appreciated.


int X264Encoder::Open(void)
{
 if (_x264VideoEncoder != NULL)
 Close();

 // Set up default parameters.
 if (x264_param_default_preset(&_param, _encoderSpeedPreset.c_str(), "zerolatency") < 0) // 0=success, -1=failed
 { _errStr = "X264Encoder::Open: Default parameter preset failed with " + _encoderSpeedPreset; return(0); }

 // Set non-default params.
 _param.i_bitdepth = 8;
 _param.i_csp = _colourSpaceMapping[_colourSpace]; // Input colour space
 if(!_param.i_csp)
 { _errStr = "X264Encoder::Open: Incompatible colour space " + to_string(_colourSpace); return(0); }
 _param.i_width = _width;
 _param.i_height = _height;
 _param.i_fps_num = _videoRateNumerator;
 _param.i_fps_den = _videoRateDenominator;

 _param.rc.i_bitrate = _avgBitsPerSecond / 1000; // bitrate units are in kbits/s

 _param.i_threads = 1;
 _param.b_vfr_input = 0; // VFR input. If 1, use timebase and timestamps for ratecontrol purposes. If 0, use fps only.
 _param.b_repeat_headers = 1; // Put SPS/PPS before each keyframe
 _param.b_annexb = 1; // If set, place start codes (4 bytes) before NAL units, otherwise place size (4 bytes) before NAL units.

 // Apply profile restrictions.
 if (x264_param_apply_profile(&_param, _profile.c_str()) < 0) // 0=success, -1=failed
 { _errStr = "X264Encoder::Open: Unable to set profile " + _profile; return(0); }

 // Initialise the encoder input pic buffer.
 if (x264_picture_alloc(&_picIn, _param.i_csp, _param.i_width, _param.i_height) < 0)
 { _errStr = "X264Encoder::Open: Unable to alloc input picture buffer"; return(0); }
 _inPicIsAllocated = true;

 // Instantiate the encoder.
 _x264VideoEncoder = x264_encoder_open(&_param);
 if (_x264VideoEncoder == NULL)
 {
 _errStr = "X264Encoder::Open: Unable to instantiate the encoder"; 
 // Clean up before exit.
 x264_picture_clean(&_picIn);
 _inPicIsAllocated = false;
 return(0);
 }//end if !_x264VideoEncoder...

 // Frame counting for pts timestamps.
 _frameNum = 0;
 _lastPicType = 0; // IDR-frame

 d.clear();

 return(1);
}//end Open.

int X264Encoder::Encode(void* pSrc, void* pCmp, void* codeParameter)
{
 _encodedFrameSize = 0;

 // Validation house work.
 if(!Ready())
 { _errStr = "X264Encoder::Encode: Not ready"; return(0); }

 if(!pSrc || !pCmp)
 { _errStr = "X264Encoder::Encode: Invalid function parameter list"; return(0); }

 // Load input image. 
 if(_param.i_csp != X264_CSP_I420) // Can only process I420 input colour space.
 { _errStr = "X264Encoder::Encode: I420 colour space required"; return(0); }
 uint32_t lumSize = _width * _height;
 uint32_t chrSize = lumSize / 4;
 // Transfer the input source image into the x264 picture img structure.
 uint8_t* pImg = static_cast(pSrc);
 memcpy_s(_picIn.img.plane[0], lumSize, pImg, lumSize);
 pImg += lumSize;
 memcpy_s(_picIn.img.plane[1], chrSize, pImg, chrSize);
 pImg += chrSize;
 memcpy_s(_picIn.img.plane[2], chrSize, pImg, chrSize);

 // Encode single frame
 _picIn.i_pts = _frameNum;
 if (_idrFrameRequired) 
 { 
 _picIn.i_type = X264_TYPE_IDR; 
 //... and clear the signal.
 _idrFrameRequired = false; 
 }//end if _idrFrameRequired...
 else 
 _picIn.i_type = X264_TYPE_AUTO;

 _encodedFrameSize = x264_encoder_encode(_x264VideoEncoder, &_nal, &_nalCnt, &_picIn, &_picOut);
 if (_encodedFrameSize > 0)
 {
 // Write the encoded stream to the output.
 uint8_t* pOut = static_cast(pCmp);
 memcpy_s(pOut, _encodedFrameSize, _nal->p_payload, _encodedFrameSize);
 }//end else if _encodedFrameSize...
 else
 { _errStr = "X264Encoder::Encode: Encode process failed"; return(0); }

 _lastPicType = 1; // Non-IDR
 if (_picOut.i_type == X264_TYPE_IDR)
 _lastPicType = 0; // IDR

 d.push_back({ _encodedFrameSize, _lastPicType });

 _frameNum++;
 return(1);
}//end Encode...



-
How do I force an IDR-frame using the x264 C API ?
28 octobre 2020, par KeithI am attempting to use an external bool signal to force the next encoded frame to be an IDR-frame using the x264 C API. I am using the "baseline" profile with the "ultrafast" and "zerolatency" presets. I tried to use the input pic settings prior to encoding, as in this code snippet, but this has not worked. My class Open() and Encode() methods are shown here. Any help will be appreciated.


int X264Encoder::Open(void)
{
 if (_x264VideoEncoder != NULL)
 Close();

 // Set up default parameters.
 if (x264_param_default_preset(&_param, _encoderSpeedPreset.c_str(), "zerolatency") < 0) // 0=success, -1=failed
 { _errStr = "X264Encoder::Open: Default parameter preset failed with " + _encoderSpeedPreset; return(0); }

 // Set non-default params.
 _param.i_bitdepth = 8;
 _param.i_csp = _colourSpaceMapping[_colourSpace]; // Input colour space
 if(!_param.i_csp)
 { _errStr = "X264Encoder::Open: Incompatible colour space " + to_string(_colourSpace); return(0); }
 _param.i_width = _width;
 _param.i_height = _height;
 _param.i_fps_num = _videoRateNumerator;
 _param.i_fps_den = _videoRateDenominator;

 _param.rc.i_bitrate = _avgBitsPerSecond / 1000; // bitrate units are in kbits/s

 _param.i_threads = 1;
 _param.b_vfr_input = 0; // VFR input. If 1, use timebase and timestamps for ratecontrol purposes. If 0, use fps only.
 _param.b_repeat_headers = 1; // Put SPS/PPS before each keyframe
 _param.b_annexb = 1; // If set, place start codes (4 bytes) before NAL units, otherwise place size (4 bytes) before NAL units.

 // Apply profile restrictions.
 if (x264_param_apply_profile(&_param, _profile.c_str()) < 0) // 0=success, -1=failed
 { _errStr = "X264Encoder::Open: Unable to set profile " + _profile; return(0); }

 // Initialise the encoder input pic buffer.
 if (x264_picture_alloc(&_picIn, _param.i_csp, _param.i_width, _param.i_height) < 0)
 { _errStr = "X264Encoder::Open: Unable to alloc input picture buffer"; return(0); }
 _inPicIsAllocated = true;

 // Instantiate the encoder.
 _x264VideoEncoder = x264_encoder_open(&_param);
 if (_x264VideoEncoder == NULL)
 {
 _errStr = "X264Encoder::Open: Unable to instantiate the encoder"; 
 // Clean up before exit.
 x264_picture_clean(&_picIn);
 _inPicIsAllocated = false;
 return(0);
 }//end if !_x264VideoEncoder...

 // Frame counting for pts timestamps.
 _frameNum = 0;
 _lastPicType = 0; // IDR-frame

 d.clear();

 return(1);
}//end Open.

int X264Encoder::Encode(void* pSrc, void* pCmp, void* codeParameter)
{
 _encodedFrameSize = 0;

 // Validation house work.
 if(!Ready())
 { _errStr = "X264Encoder::Encode: Not ready"; return(0); }

 if(!pSrc || !pCmp)
 { _errStr = "X264Encoder::Encode: Invalid function parameter list"; return(0); }

 // Load input image. 
 if(_param.i_csp != X264_CSP_I420) // Can only process I420 input colour space.
 { _errStr = "X264Encoder::Encode: I420 colour space required"; return(0); }
 uint32_t lumSize = _width * _height;
 uint32_t chrSize = lumSize / 4;
 // Transfer the input source image into the x264 picture img structure.
 uint8_t* pImg = static_cast(pSrc);
 memcpy_s(_picIn.img.plane[0], lumSize, pImg, lumSize);
 pImg += lumSize;
 memcpy_s(_picIn.img.plane[1], chrSize, pImg, chrSize);
 pImg += chrSize;
 memcpy_s(_picIn.img.plane[2], chrSize, pImg, chrSize);

 // Encode single frame
 _picIn.i_pts = _frameNum;
 if (_idrFrameRequired) 
 { 
 _picIn.i_type = X264_TYPE_IDR; 
 //... and clear the signal.
 _idrFrameRequired = false; 
 }//end if _idrFrameRequired...
 else 
 _picIn.i_type = X264_TYPE_AUTO;

 _encodedFrameSize = x264_encoder_encode(_x264VideoEncoder, &_nal, &_nalCnt, &_picIn, &_picOut);
 if (_encodedFrameSize > 0)
 {
 // Write the encoded stream to the output.
 uint8_t* pOut = static_cast(pCmp);
 memcpy_s(pOut, _encodedFrameSize, _nal->p_payload, _encodedFrameSize);
 }//end else if _encodedFrameSize...
 else
 { _errStr = "X264Encoder::Encode: Encode process failed"; return(0); }

 _lastPicType = 1; // Non-IDR
 if (_picOut.i_type == X264_TYPE_IDR)
 _lastPicType = 0; // IDR

 d.push_back({ _encodedFrameSize, _lastPicType });

 _frameNum++;
 return(1);
}//end Encode...



-
FFmpeg - Save %{pts\:hms} in %variable% for saving as environment variable
29 novembre 2020, par cmd_kevinAfter closing a video in ffplay I want that the last timestamp will saved as a value of an environment variable.


To show the current timestamp in the playback window, I can use :


ffplay -vf "drawtext=text='%{pts\:hms}'" input.mp4



So there is a variable (
%{pts\:hms}
) for my purposes.

To change the value of a variable (in my case
%variable01%
), I used :

SET variable01=value



To change the environment variable with
%variable01%
, I used :SETX environment_variable_01 %variable01%
.

My problem is that I can't use
%{pts\:hms}
to define%variable01%
andecho %{pts\:hms}
orSETX environment_variable_01 %{pts\:hms}
didn't work.

So I'm trying to transfer the
%{pts\:hms}
value to%variable01%
but all of my attempts failed.

What can I do to solve my problem ?


I want this environment value to continue a video at the timestamp I closed ffplay and the command prompt.


Edit1 : I have used search facility but I didn't find an answer, especially to this specific syntax with only one percent sign
%{pts\:hms}
.

Here's my reproducible example :

ffplay -vf "drawtext=text='%{pts\:hms}'" input.mp4 & echo %{pts:hms}

Answer :%{pts\:hms}
.

I also tried :


ffplay -vf "drawtext=text='%{pts\:hms}'" input.mp4 & SET variable01=%{pts\:hms}



but the answer with


echo %variable01%



is


%{pts\:hms}.



Changing to
%{pts\:hms}%
didn't work too. The answer of echo is%{pts\:hms}%
.