
Recherche avancée
Autres articles (55)
-
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 (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (8255)
-
ffmpeg crashes on crossfades between 3 clips if 2 clips coming from same input file [closed]
14 avril 2020, par ErikI observed that ffmpeg 4.2.2 (macOS) crashes in particular cases of crossfades between clips, if one clip comes from file
1.dv
, and two clips are cut out of file2.dv
, as shown below :


ffmpeg -f lavfi -i color=black:size=720x576:duration=11:rate=25 -i 1.dv -i 2.dv -filter_complex "\
 [1:v]trim=5:10,setpts=expr=PTS-STARTPTS,yadif,fade=alpha=1:d=2:st=3:type=out,setpts=expr=PTS-STARTPTS,fifo[s5];\
 [2:v]split=2[s7][s8];\
 [s7]trim=5:10,setpts=expr=PTS-STARTPTS,yadif,fade=alpha=1:d=2:type=in,fade=alpha=1:d=2:st=6:type=out,setpts=expr=PTS-STARTPTS+(3/TB),fifo[s15];\
 [s8]trim=12:17,setpts=expr=PTS-STARTPTS,yadif,fade=alpha=1:d=2:type=in,setpts=expr=PTS-STARTPTS+(6/TB),fifo[s22];\
 [0:v][s5]overlay=eof_action=repeat[s6];\
 [s6][s15]overlay=eof_action=repeat[s16];\
 [s16][s22]overlay=eof_action=repeat[s24];\
 [1:a]atrim=5:10,asetpts=expr=PTS-STARTPTS[s26];\
 [2:a]asplit=2[s27][s28];\
 [s27]atrim=5:10,asetpts=expr=PTS-STARTPTS[s30];\
 [s28]atrim=12:17,asetpts=expr=PTS-STARTPTS[s33];\
 [s26][s30]acrossfade=d=2[s31];\
 [s31][s33]acrossfade=d=2[s36]" \
 -map "[s24]" -map "[s36]" -ab 128k -acodec aac -crf 23 -movflags faststart -preset medium -tune film -vcodec libx264 -aspect 1024:576 out.mp4 -y




The order makes a difference : if the two clips from
2.dv
are used first and then the clip from1.dv
is appended, everything works fine. Also, if all clips are coming from different files.


ffmpeg 3.4.6 (ubuntu 18.04) shows no issues in any case.



A self-compiled ffmpeg version N-97322-gb1699f4 (commit 2020-04-13) works with short clips as above, but crashes if one of the two clips taken from
2.dv
is getting longer. In my tests 1500 frames (64 sec) is OK, 1700 (68 sec) leads to a segmentation fault. That is, if you replace in the command line above :


- 

[s7]trim=5:10...
->[s7]trim=0:68
and accordingly[s27]atrim=5:10...
->[s27]atrim=0:68







Interestingly, the length of the clip taken from
1.dv
does not play a role.


The ffmpeg output shows about 20 times :



frame= 0 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 




before it continues (seg fault case) :



frame= 4 fps=0.3 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 24 fps=1.6 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 25 fps=1.5 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 34 fps=1.9 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 36 fps=2.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 39 fps=2.1 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 40 fps=2.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 40 fps=2.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 40 fps=1.9 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 





success case :



frame= 5 fps=0.4 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 42 fps=3.2 q=28.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x 
frame= 53 fps=3.9 q=28.0 size= 0kB time=00:00:00.36 bitrate= 2.9kbits/s speed=0.0264x 
frame= 65 fps=4.6 q=28.0 size= 0kB time=00:00:00.84 bitrate= 1.2kbits/s speed=0.0594x 
... 




Slightly older versions included in the newest MacOS builds from zeranoe.com (git-2020-04-13-59e3a9a) and evermeet.cx (N-97308-g14dd0a9057-tessus, from 2020-04-12) are working nicely - also on my production cases (longer clips).



Any feedback would be appreciated !


-
error when converting .flv to .mp4 using ffmpeg
14 août 2024, par JayceI converted the 1.flv file using the tool on https://convertio.co/ and still created a normal .mp4 file. However, when I use the python code, I get the error below.


import os 
import subprocess 
 
def convert_flv_to_mp4(input_file, output_file): 
 try: 
 subprocess.run(["ffmpeg", "-i", input_file, "-c:v", "libx264", "-c:a", "aac", "-preset", "medium", "-crf", "23", output_file], check=True)
 except subprocess.CalledProcessError as e: 
 print(f"error {input_file} to {output_file}: {e}") 
 
if __name__ == "__main__": 
 input_file = r"C:\Users\vann4\OneDrive\Desktop\flv\1.flv" 
 output_file = r"C:\Users\vann4\OneDrive\Desktop\flv\1.mp4" 
 convert_flv_to_mp4(input_file, output_file) 



[flv @ 0000016342270d80] Video codec (c) is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[flv @ 0000016342270d80] If you want to help, upload a sample of this file to https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
[flv @ 0000016342270d80] Could not find codec parameters for stream 1 (Video: none ([12][0][0][0] / 0x000C), none, 1150 kb/s): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, flv, from 'C:\Users\vann4\OneDrive\Desktop\flv\1.flv':
 Metadata:
 start_time : 1723543887483
 fp_coderate : 1150000
 sdk_version : 16.8.1.2
 old_link_info : (push-rtmp-f5-sg01.tiktokcdn.com:stage:stream-2133275252817395781)n.vn-lts55c.7qmt_34825,n.my-93iclg.4epc_3521416 
 default_bitrate : 1700
 fp_vmode : 1
 max_bitrate : 2700
 fp_amode : 0
 push_protocol : rtmpq
 fp_dispatch_expr_tag:
 e_id : 0
 stream_id : push-rtmp-f5-sg01.tiktokcdn.com:stage:stream-2133275252817395781_uhd5b
 s_id : 8
 h_id : 4
 interval : 2
 publish_time_stamp: 1723543887
 encoder : Lavf58.45.100
 min_bitrate : 1000
 link_info : n.my-93iclg.4epc_3521416,n.my-93iclg.hebn_3413106,n.sg-awn1ns.n4qb_644528,n.sg-awn1ns.kq7p_4176740,n.sg-elmss9.00jt_909,n.sg-elmss9.d4b4_59676,n.vn-6tkh26.ntnt_2987,n.vn-6tkh26.vuv7_56190
 is_hardware_encode: 1
 model : iPhone XR
 hit_node_optimize: 0
 fp_nb : 0
 ab : 0
 p_id : 0
 os_version : 17.5.1
 platform : iOS
 qId : {"newbitrate_ios_bT":1,"ByteAudioAUUnsplit+new_session_api+with_aec_sw_true+framesize_10ms":true,"rc_bwe_ios":4,"ios_70742354_2":2,"not_rc_bwe_ios":1,"ios_fix_low_enc_bit_vpaas_4":4,"default_config_bugfix":1,"newbitrate_ios_resolution_no480p":1} 
 Duration: 00:02:26.09, start: 0.000000, bitrate: 958 kb/s
 Stream #0:0: Audio: aac (HE-AAC), 44100 Hz, stereo, fltp, 64 kb/s
 Stream #0:1: Video: none ([12][0][0][0] / 0x000C), none, 1150 kb/s, 25 fps, 25 tbr, 1k tbn
[vist#0:1/none @ 0000016343d38c00] Decoding requested, but no decoder found for: none
Error opening output file C:\Users\vann4\OneDrive\Desktop\flv\1.mp4.
Error opening output files: Invalid argument
error C:\Users\vann4\OneDrive\Desktop\flv\1.flv to C:\Users\vann4\OneDrive\Desktop\flv\1.mp4: Command '['ffmpeg', '-i', 'C:\\Users\\vann4\\OneDrive\\Desktop\\flv\\1.flv', '-c:v', 'libx264', '-c:a', 'aac', '-preset', 'medium', '-crf', '23', 'C:\\Users\\vann4\\OneDrive\\Desktop\\flv\\1.mp4']' returned non-zero exit status 4294967274.



I tried converting the .mp4 file to .avi and it's completely normal.


hope everyone can help me. Thanks for reading


-
Recording video on Android using JavaCV
11 décembre 2013, par Fabio BergmannI'm trying to record a video in Android using the JavaCV lib.
I need to record the video in 640x360.I have installed everything as described in README.txt file and I followed the example as below :
https://code.google.com/p/javacv/source/browse/samples/RecordActivity.java
In this example, the video size is this :
private int imageWidth = 320 ;
private int imageHeight = 240 ;In my case, I need to record a video in 640x360 H.264.
But, or I get an exception or the video records with no correct image.I think that the fix is arround a correct combination on :
yuvIplimage = IplImage.create(imageWidth, imageHeight, IPL_DEPTH_8S, 2) ;
changing the depth and :
recorder.record(yuvIplimage, AV_PIX_FMT_VDPAU_H264) ;
the pixel format.Here is my code :
import static com.googlecode.javacv.cpp.avutil.AV_PIX_FMT_NONE;
import static com.googlecode.javacv.cpp.opencv_core.IPL_DEPTH_8U;
import java.io.IOException;
import java.nio.ShortBuffer;
import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.hardware.Camera;
import android.hardware.Camera.PreviewCallback;
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.os.PowerManager;
import android.util.Log;
import android.view.Display;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.autosonvideo.logic.CameraHelpers;
import com.googlecode.javacv.FFmpegFrameRecorder;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
public class FFmpegRecordActivity extends Activity implements OnClickListener {
private final static String CLASS_LABEL = "RecordActivity";
private final static String LOG_TAG = CLASS_LABEL;
private PowerManager.WakeLock mWakeLock;
private String ffmpeg_link = "/mnt/sdcard/stream.flv";
long startTime = 0;
boolean recording = false;
private volatile FFmpegFrameRecorder recorder;
private boolean isPreviewOn = false;
private int sampleAudioRateInHz = 44100;
private int imageWidth = 640;
private int imageHeight = 360;
private int frameRate = 30;
/* audio data getting thread */
private AudioRecord audioRecord;
private AudioRecordRunnable audioRecordRunnable;
private Thread audioThread;
volatile boolean runAudioThread = true;
/* video data getting thread */
private Camera cameraDevice;
private CameraView cameraView;
private IplImage yuvIplimage = null;
/* layout setting */
private final int bg_screen_bx = 232;
private final int bg_screen_by = 128;
private final int bg_screen_width = 700;
private final int bg_screen_height = 500;
private final int bg_width = 1123;
private final int bg_height = 715;
private final int live_width = 640;
private final int live_height = 360;
private int screenWidth, screenHeight;
private Button btnRecorderControl;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setContentView(R.layout.main);
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
CLASS_LABEL);
mWakeLock.acquire();
initLayout();
initRecorder();
}
@Override
protected void onResume() {
super.onResume();
if (mWakeLock == null) {
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
CLASS_LABEL);
mWakeLock.acquire();
}
}
@Override
protected void onPause() {
super.onPause();
if (mWakeLock != null) {
mWakeLock.release();
mWakeLock = null;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
recording = false;
if (cameraView != null) {
cameraView.stopPreview();
cameraDevice.release();
cameraDevice = null;
}
if (mWakeLock != null) {
mWakeLock.release();
mWakeLock = null;
}
}
private void initLayout() {
/* get size of screen */
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
screenWidth = display.getWidth();
screenHeight = display.getHeight();
RelativeLayout.LayoutParams layoutParam = null;
LayoutInflater myInflate = null;
myInflate = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RelativeLayout topLayout = new RelativeLayout(this);
setContentView(topLayout);
LinearLayout preViewLayout = (LinearLayout) myInflate.inflate(
R.layout.main, null);
layoutParam = new RelativeLayout.LayoutParams(screenWidth, screenHeight);
topLayout.addView(preViewLayout, layoutParam);
/* add control button: start and stop */
btnRecorderControl = (Button) findViewById(R.id.recorder_control);
btnRecorderControl.setText("Start");
btnRecorderControl.setOnClickListener(this);
/* add camera view */
int display_width_d = (int) (1.0 * bg_screen_width * screenWidth / bg_width);
int display_height_d = (int) (1.0 * bg_screen_height * screenHeight / bg_height);
int prev_rw, prev_rh;
if (1.0 * display_width_d / display_height_d > 1.0 * live_width
/ live_height) {
prev_rh = display_height_d;
prev_rw = (int) (1.0 * display_height_d * live_width / live_height);
} else {
prev_rw = display_width_d;
prev_rh = (int) (1.0 * display_width_d * live_height / live_width);
}
layoutParam = new RelativeLayout.LayoutParams(prev_rw, prev_rh);
layoutParam.topMargin = (int) (1.0 * bg_screen_by * screenHeight / bg_height);
layoutParam.leftMargin = (int) (1.0 * bg_screen_bx * screenWidth / bg_width);
cameraDevice = Camera.open();
Log.i(LOG_TAG, "cameara open");
cameraView = new CameraView(this, cameraDevice);
topLayout.addView(cameraView, layoutParam);
Log.i(LOG_TAG, "cameara preview start: OK");
}
// ---------------------------------------
// initialize ffmpeg_recorder
// ---------------------------------------
private void initRecorder() {
Log.w(LOG_TAG, "init recorder");
if (yuvIplimage == null) {
yuvIplimage = IplImage.create(imageWidth, imageHeight,
IPL_DEPTH_8U, 2);
Log.i(LOG_TAG, "create yuvIplimage");
}
ffmpeg_link = CameraHelpers.getOutputMediaFile(
CameraHelpers.MEDIA_TYPE_VIDEO).toString();
Log.i(LOG_TAG, "ffmpeg_url: " + ffmpeg_link);
recorder = new FFmpegFrameRecorder(ffmpeg_link, imageWidth,
imageHeight, 1);
recorder.setFormat("mp4");
recorder.setSampleRate(sampleAudioRateInHz);
// Set in the surface changed method
recorder.setFrameRate(frameRate);
Log.i(LOG_TAG, "recorder initialize success");
audioRecordRunnable = new AudioRecordRunnable();
audioThread = new Thread(audioRecordRunnable);
}
public void startRecording() {
try {
recorder.start();
startTime = System.currentTimeMillis();
recording = true;
audioThread.start();
} catch (FFmpegFrameRecorder.Exception e) {
e.printStackTrace();
}
}
public void stopRecording() {
runAudioThread = false;
if (recorder != null && recording) {
recording = false;
Log.v(LOG_TAG,
"Finishing recording, calling stop and release on recorder");
try {
recorder.stop();
recorder.release();
} catch (FFmpegFrameRecorder.Exception e) {
e.printStackTrace();
}
recorder = null;
}
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (recording) {
stopRecording();
}
finish();
return true;
}
return super.onKeyDown(keyCode, event);
}
// ---------------------------------------------
// audio thread, gets and encodes audio data
// ---------------------------------------------
class AudioRecordRunnable implements Runnable {
@Override
public void run() {
android.os.Process
.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);
// Audio
int bufferSize;
short[] audioData;
int bufferReadResult;
bufferSize = AudioRecord
.getMinBufferSize(sampleAudioRateInHz,
AudioFormat.CHANNEL_IN_MONO,
AudioFormat.ENCODING_PCM_16BIT);
audioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,
sampleAudioRateInHz, AudioFormat.CHANNEL_IN_MONO,
AudioFormat.ENCODING_PCM_16BIT, bufferSize);
audioData = new short[bufferSize];
Log.d(LOG_TAG, "audioRecord.startRecording()");
audioRecord.startRecording();
/* ffmpeg_audio encoding loop */
while (runAudioThread) {
// Log.v(LOG_TAG,"recording? " + recording);
bufferReadResult = audioRecord.read(audioData, 0,
audioData.length);
if (bufferReadResult > 0) {
// Log.v(LOG_TAG, "bufferReadResult: " + bufferReadResult);
// If "recording" isn't true when start this thread, it
// never get's set according to this if statement...!!!
// Why? Good question...
if (recording) {
try {
recorder.record(ShortBuffer.wrap(audioData, 0,
bufferReadResult));
// Log.v(LOG_TAG,"recording " + 1024*i + " to " +
// 1024*i+1024);
} catch (FFmpegFrameRecorder.Exception e) {
Log.v(LOG_TAG, e.getMessage());
e.printStackTrace();
}
}
}
}
Log.v(LOG_TAG, "AudioThread Finished, release audioRecord");
/* encoding finish, release recorder */
if (audioRecord != null) {
audioRecord.stop();
audioRecord.release();
audioRecord = null;
Log.v(LOG_TAG, "audioRecord released");
}
}
}
// ---------------------------------------------
// camera thread, gets and encodes video data
// ---------------------------------------------
class CameraView extends SurfaceView implements SurfaceHolder.Callback,
PreviewCallback {
private SurfaceHolder mHolder;
private Camera mCamera;
public CameraView(Context context, Camera camera) {
super(context);
Log.w("camera", "camera view");
mCamera = camera;
mHolder = getHolder();
mHolder.addCallback(CameraView.this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mCamera.setPreviewCallback(CameraView.this);
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
try {
stopPreview();
mCamera.setPreviewDisplay(holder);
} catch (IOException exception) {
mCamera.release();
mCamera = null;
}
}
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
Log.v(LOG_TAG, "Setting imageWidth: " + imageWidth
+ " imageHeight: " + imageHeight + " frameRate: "
+ frameRate);
Camera.Parameters camParams = mCamera.getParameters();
camParams.setPreviewSize(imageWidth, imageHeight);
Log.v(LOG_TAG,
"Preview Framerate: " + camParams.getPreviewFrameRate());
camParams.setPreviewFrameRate(frameRate);
mCamera.setParameters(camParams);
startPreview();
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
try {
mHolder.addCallback(null);
mCamera.setPreviewCallback(null);
} catch (RuntimeException e) {
// The camera has probably just been released, ignore.
}
}
public void startPreview() {
if (!isPreviewOn && mCamera != null) {
isPreviewOn = true;
mCamera.startPreview();
}
}
public void stopPreview() {
if (isPreviewOn && mCamera != null) {
isPreviewOn = false;
mCamera.stopPreview();
}
}
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
/* get video data */
if (yuvIplimage != null && recording) {
int cap = yuvIplimage.getByteBuffer().capacity();
int dataLen = data.length;
Log.d("FFmpeg", "cap: " + cap + " data: " + dataLen);
yuvIplimage.getByteBuffer().put(data);
Log.v(LOG_TAG, "Writing Frame");
try {
long t = 1000 * (System.currentTimeMillis() - startTime);
if (t > recorder.getTimestamp()) {
recorder.setTimestamp(t);
}
recorder.record(yuvIplimage, AV_PIX_FMT_NONE);
} catch (FFmpegFrameRecorder.Exception e) {
Log.v(LOG_TAG, e.getMessage());
e.printStackTrace();
}
}
}
}
@Override
public void onClick(View v) {
if (!recording) {
startRecording();
Log.w(LOG_TAG, "Start Button Pushed");
btnRecorderControl.setText("Stop");
} else {
// This will trigger the audio recording loop to stop and then set
// isRecorderStart = false;
stopRecording();
Log.w(LOG_TAG, "Stop Button Pushed");
btnRecorderControl.setText("Start");
}
}
}Thanks in advance !