
Recherche avancée
Autres articles (68)
-
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 -
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 -
Participer à sa documentation
10 avril 2011La documentation est un des travaux les plus importants et les plus contraignants lors de la réalisation d’un outil technique.
Tout apport extérieur à ce sujet est primordial : la critique de l’existant ; la participation à la rédaction d’articles orientés : utilisateur (administrateur de MediaSPIP ou simplement producteur de contenu) ; développeur ; la création de screencasts d’explication ; la traduction de la documentation dans une nouvelle langue ;
Pour ce faire, vous pouvez vous inscrire sur (...)
Sur d’autres sites (13379)
-
FFMPEG picture in picture
19 février 2016, par JalyoI try to put a portion of video in a video at a certain time.
Se here’s my command :
./ffmpeg-3.0-32bit-static/ffmpeg \
-y \
-i main.mp4 \
-itsoffset -10 \
-i overlay.mp4 \
-filter_complex \
"[1:a] atrim=5:20 [1:a1]; \
[1:a1] adelay=5000|5000 [1:a2]; \
[0:a][1:a2] amix [outa]; \
[1:v] scale=120:-1 [1:v1]; \
[0:v][1:v1] overlay=x=25:y=25:enable='between(t,5,20)'[outv]" \
-map "[outv]" \
-map "[outa]" \
-c:a aac \
-c:v libx264 \
-vb 1000k \
-r 24 \
-strict -2 \
output.mp4But I’ve got "Buffer queue overflow, dropping" messages which, I think, makes my overlay.mp4 a little jerky on the output.mp4 :
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.
Last message repeated 50 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.0.927x
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=2.72x
Last message repeated 33 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=2.72x
Last message repeated 14 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=2.97x
Last message repeated 13 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=3.16x
Last message repeated 35 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=3.35x
Last message repeated 45 times
[Parsed_overlay_4 @ 0xc29d9c0] [framesync @ 0xc29da84] Buffer queue overflow, dropping.=3.46x
Last message repeated 5 timesAny idea why ?
EDIT : Forgot to say I’ve got the last version of ffmpeg => 3.0.
-
Raspberry Pi USB Webcam Stream to Computer using Gstreamer
17 mars 2016, par JamesI have a fisheye usb webcam attached to a raspberry pi that I’m trying to stream to a computer. I’ve played with ffmpeg and it seems a little laggy beyond 320x240. From what I’ve read people have been happy with gstreamer.
So I’ve tested the usb webcam and it works locally
gst-launch-1.0 -v v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480' ! glimagesink
These are the commands I’ve been trying to use to get the video to my computer. However, all I’m seeing is a green window.
TCP Sever :
gst-launch-1.0 -v v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480,framerate=30/1' ! x264enc byte-stream=true ! rtph264pay ! gdppay ! tcpserversink host=192.168.200.38 port=5000 sync=false
TCP Client :
gst-launch-1.0 -v tcpclientsrc host=192.168.200.38 port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false
or
UDP Server :
gst-launch-1.0 -v v4l2src device=/dev/video0 ! 'video/x-raw,width=640,height=480,framerate=30/1' ! x264enc byte-stream=true ! rtph264pay ! gdppay ! udpsink host=192.168.200.37 port=5000 sync=false
UDP Client :
gst-launch-1.0 -v udpsrc port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false
I figure I must be piping the plugins wrong somehow. Any advice is appreciated.
-
Android : Pass video path to FFmpeg
29 septembre 2020, par marianI have developed an app that play video from gallery. I would like to add watermark using
FFmpeg
command in the video selected. But I do not know how to pass the path to theFFmpeg
command. I could not find proper tutorials or reference regarding this. My coding are as follows :

MainActivity.java :


public class MainActivity extends Activity {
public ProgressDialog progressBar;

String workFolder = null;
String demoVideoFolder = null;
String demoVideoPath = null;
String vkLogPath = null;
LoadJNI vk;
private final int STOP_TRANSCODING_MSG = -1;
private final int FINISHED_TRANSCODING_MSG = 0;
private boolean commandValidationFailedFlag = false;

Button button;
VideoView videoView;
private static final int PICK_FROM_GALLERY = 1;


private void runTranscodingUsingLoader() {
 Log.i(Prefs.TAG, "runTranscodingUsingLoader started...");

 PowerManager powerManager = (PowerManager)MainActivity.this.getSystemService(Activity.POWER_SERVICE);
 PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VK_LOCK");
 Log.d(Prefs.TAG, "Acquire wake lock");
 wakeLock.acquire();

 

 String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental",
 "-vf", "movie=/sdcard/videokit/watermark.png [watermark];" +
 " [in][watermark] overlay=main_w-overlay_w-10:10 [out]","-s",
 "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab",
 "48000", "-ac", "2", "-ar", "22050", "/sdcard/videokit/out1.mp4"};
 ///////////////////////////////////////////////////////////////////////


 vk = new LoadJNI();
 try {
 // running complex command with validation
 vk.run(complexCommand, workFolder, getApplicationContext());

 // running without command validation
 //vk.run(complexCommand, workFolder, getApplicationContext(), false);

 // running regular command with validation
 //vk.run(GeneralUtils.utilConvertToComplex(commandStr), workFolder, getApplicationContext());

 Log.i(Prefs.TAG, "vk.run finished.");
 // copying vk.log (internal native log) to the videokit folder
 GeneralUtils.copyFileToFolder(vkLogPath, demoVideoFolder);

 } catch (CommandValidationException e) {
 Log.e(Prefs.TAG, "vk run exeption.", e);
 commandValidationFailedFlag = true;

 } catch (Throwable e) {
 Log.e(Prefs.TAG, "vk run exeption.", e);
 }
 finally {
 if (wakeLock.isHeld()) {
 wakeLock.release();
 Log.i(Prefs.TAG, "Wake lock released");
 }
 else{
 Log.i(Prefs.TAG, "Wake lock is already released, doing nothing");
 }
 }

 // finished Toast
 String rc = null;
 if (commandValidationFailedFlag) {
 rc = "Command Vaidation Failed";
 }
 else {
 rc = GeneralUtils.getReturnCodeFromLog(vkLogPath);
 }
 final String status = rc;
 MainActivity.this.runOnUiThread(new Runnable() {
 public void run() {
 Toast.makeText(MainActivity.this, status, Toast.LENGTH_LONG).show();
 if (status.equals("Transcoding Status: Failed")) {
 Toast.makeText(MainActivity.this, "Check: " + vkLogPath + " for more information.", Toast.LENGTH_LONG).show();
 }
 }
 });
}


@Override
public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);

 button = (Button) findViewById(R.id.button);
 
 videoView = (VideoView) findViewById(R.id.videoview);

 button.setOnClickListener(new View.OnClickListener() {

 public void onClick(View v) {
 // TODO Auto-generated method stub
 Intent intent = new Intent();

 intent.setType("video/*");
 intent.setAction(Intent.ACTION_GET_CONTENT);

 startActivityForResult(Intent.createChooser(intent, "Complete action using"), PICK_FROM_GALLERY);
 }
 });

}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
 if (resultCode != RESULT_OK) return;

 if (requestCode == PICK_FROM_GALLERY) {
 Uri mVideoURI = data.getData();
 videoView.setVideoURI(mVideoURI);
 videoView.start();
 demoVideoFolder = mVideoURI.getPath();
 demoVideoPath = demoVideoFolder;
 savevideo(mVideoURI);

 }


}
private Handler handler = new Handler() {
 @Override
 public void handleMessage(Message msg) {
 Log.i(Prefs.TAG, "Handler got message");
 if (progressBar != null) {
 progressBar.dismiss();

 // stopping the transcoding native
 if (msg.what == STOP_TRANSCODING_MSG) {
 Log.i(Prefs.TAG, "Got cancel message, calling fexit");
 vk.fExit(getApplicationContext());


 }
 }
 }
};

public void runTranscoding() {
 progressBar = new ProgressDialog(MainActivity.this);
 progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
 progressBar.setTitle("FFmpeg4Android Direct JNI");
 progressBar.setMessage("Press the cancel button to end the operation");
 progressBar.setMax(100);
 progressBar.setProgress(0);

 progressBar.setCancelable(false);
 progressBar.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
 @Override
 public void onClick(DialogInterface dialog, int which) {
 handler.sendEmptyMessage(STOP_TRANSCODING_MSG);
 }
 });

 progressBar.show();

 new Thread() {
 public void run() {
 Log.d(Prefs.TAG,"Worker started");
 try {
 //sleep(5000);
 runTranscodingUsingLoader();
 handler.sendEmptyMessage(FINISHED_TRANSCODING_MSG);

 } catch(Exception e) {
 Log.e("threadmessage",e.getMessage());
 }
 }
 }.start();

 // Progress update thread
 new Thread() {
 ProgressCalculator pc = new ProgressCalculator(vkLogPath);
 public void run() {
 Log.d(Prefs.TAG,"Progress update started");
 int progress = -1;
 try {
 while (true) {
 sleep(300);
 progress = pc.calcProgress();
 if (progress != 0 && progress < 100) {
 progressBar.setProgress(progress);
 }
 else if (progress == 100) {
 Log.i(Prefs.TAG, "==== progress is 100, exiting Progress update thread");
 pc.initCalcParamsForNextInter();
 break;
 }
 }

 } catch(Exception e) {
 Log.e("threadmessage",e.getMessage());
 }
 }
 }.start();
}

public void savevideo (Uri mVideoURI){
 demoVideoFolder = mVideoURI.getPath();
 demoVideoPath = demoVideoFolder;
 Log.i(Prefs.TAG, getString(R.string.app_name) + " version: " + GeneralUtils.getVersionName(getApplicationContext()));

 Button invoke = (Button) findViewById(R.id.button);
 invoke.setOnClickListener(new View.OnClickListener() {
 public void onClick(View v) {
 Log.i(Prefs.TAG, "run clicked.");
 runTranscoding();
 }
 });

 workFolder = getApplicationContext().getFilesDir() + "/";
 Log.i(Prefs.TAG, "workFolder (license and logs location) path: " + workFolder);
 vkLogPath = workFolder + "vk.log";
 Log.i(Prefs.TAG, "vk log (native log) path: " + vkLogPath);
 GeneralUtils.copyLicenseFromAssetsToSDIfNeeded(this, workFolder);
 GeneralUtils.copyDemoVideoFromAssetsToSDIfNeeded(this, demoVideoFolder);
 int rc = GeneralUtils.isLicenseValid(getApplicationContext(), workFolder);
 Log.i(Prefs.TAG, "License check RC: " + rc);

}
}



FFmpeg command :


String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental",
 "-vf", "movie=/sdcard/videokit/watermark.png [watermark];" +
 " [in][watermark] overlay=main_w-overlay_w-10:10 [out]","-s",
 "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab",
 "48000", "-ac", "2", "-ar", "22050", "/sdcard/videokit/out1.mp4"};



Tis command is from a sample project. How do I pass the video path to this command ? I do not know how to edit the command to support my requirement. Can someone guide me through this. Any help will be really helpful. Thank you.