Recherche avancée

Médias (1)

Mot : - Tags -/biomaping

Autres articles (67)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

  • Qualité du média après traitement

    21 juin 2013, par

    Le bon réglage du logiciel qui traite les média est important pour un équilibre entre les partis ( bande passante de l’hébergeur, qualité du média pour le rédacteur et le visiteur, accessibilité pour le visiteur ). Comment régler la qualité de son média ?
    Plus la qualité du média est importante, plus la bande passante sera utilisée. Le visiteur avec une connexion internet à petit débit devra attendre plus longtemps. Inversement plus, la qualité du média est pauvre et donc le média devient dégradé voire (...)

Sur d’autres sites (4437)

  • Why is this code not writing png file ? I can not get any error code

    3 décembre 2019, par Go0od

    It not writing png file. I can’t get any error code. I want to save central widget to png file. I have 2 files, one is main file and second one is ui file. At first the program does not run properly and crashes. Link has ui file

    main.py

    import sys
    from PyQt5.QtWidgets import QWidget
    from PyQt5 import QtCore, QtGui, QtWidgets
    from green import Ui_MainWindow
    class MyWindow(QtWidgets.QMainWindow, Ui_MainWindow, QWidget):
      def __init__(self):
       QtWidgets.QMainWindow.__init__(self)
       Ui_MainWindow.__init__(self)

       self.setupUi(self)
       self.widger_screen()

    def widger_screen(self):

       self.process = QtCore.QProcess(app)
       self.process.setProcessChannelMode(self.process.ForwardedChannels)
       self.process.setOpenMode(self.process.WriteOnly)
       self.process.start('ffmpeg',
                          ['-y',
                           '-analyzeduration', '1000',
                           '-vcodec', 'png', '-i', '-',
                           '-vcodec', 'mpeg4',
                           '-qscale', '5', '-r', '24', 'video.avi',
                           "-loglevel2", "debug"])
       for i in range(100):
           QWidget.grab(self.centralwidget).save(self.process, "PNG")

    if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    window = MyWindow()
    window.show()
    sys.exit(app.exec_())

    green.ui
    https://paste.pythondiscord.com/ugorifokiq.py

  • Revision 52bddd44c0 : Clean up error return code in alloccommon.c Clean up the duplicate code as Pasc

    11 octobre 2012, par Yunqing Wang

    Changed Paths : Modify /vp8/common/alloccommon.c Clean up error return code in alloccommon.c Clean up the duplicate code as Pascal suggested. Change-Id : I685fcbb488502e969f6cb73a46db3ea79b90910d

  • Audio Video Mixing - Sync issue in Android with FFMPEG, Media Codec in different devices

    24 novembre 2020, par khushbu

    I have already tried everything for Audio Video mixing and it's not working perfectly as in processing while mixing audio into the recorded video, sometimes the audio is ahead of video and vice-versa.

    


    Using FFMPEG :

    


    This is for add an Audio file to the Video file and generated the final Video where audio is replaced in the video.

    


    val cmd ="-i $inputVideoPath -i ${inputAudio.absolutePath} -map 0:v -map 1:a -c:v copy -shortest ${outputVideo.absolutePath}"


    


    After generating the final video, found some delay based on device performance so added delay in the below two cases :

    


    1)Added delay in Audio if audio is ahead of the video.

    


    val  cmd =  "-i ${tmpVideo.absolutePath} -itsoffset $hms -i ${tmpVideo.absolutePath} -map 0:v -map 1:a -c copy -preset veryfast ${createdVideo1?.absolutePath}"


    


    2)Added delay in Video if the video is ahead of the audio.

    


    val  cmd =   "-i ${tmpVideo.absolutePath} -itsoffset $hms -i ${tmpVideo.absolutePath} -map 1:v -map 0:a -c copy -preset veryfast ${createdVideo1?.absolutePath}"


    


    NOTE : Here $hms is delay in 00:00:00.000 formate

    


    but still, it's not working on all the devices like readmi, oneplus etc.

    


    Using Media Codec :

    


    Found some better performance in this solution but still not working on all the devices.

    


    In this process, It's supporting .aac format so first if the user selected .mp3 formate than i have to convert it into .aac format using the below function :

    


    fun Convert_Mp3_to_acc() {

   
    AndroidAudioConverter.load(requireActivity(), object : ILoadCallback {
        override fun onSuccess() {

            val callback: IConvertCallback = object : IConvertCallback {
                override fun onSuccess(convertedFile: File) {
                    toggleLoader(false)
                    audioLink = convertedFile.absolutePath
                    append()
                 

                }

                override fun onFailure(error: java.lang.Exception) {
                    toggleLoader(false)
                    Toast.makeText(requireActivity(), "" + error, Toast.LENGTH_SHORT).show()
                }
            }
            AndroidAudioConverter.with(requireActivity())
                .setFile(File(audioLink))
                .setFormat(AudioFormat.AAC)
                .setCallback(callback)
                .convert()
        }

        override fun onFailure(error: java.lang.Exception) {
            toggleLoader(false)
        }
    })
}


    


    After successful conversion from .mp3 to .aac formate, It's extracting audio track and video track for merge

    


     private fun append(): Boolean {&#xA;&#xA;    val progressDialog = ProgressDialog(requireContext())&#xA;    Thread {&#xA;        requireActivity().runOnUiThread {&#xA;            progressDialog.setMessage("Please wait..")&#xA;            progressDialog.show()&#xA;        }&#xA;        val video_list = ArrayList<string>()&#xA;        for (i in videopaths.indices) {&#xA;            val file: File = File(videopaths.get(i))&#xA;            if (file.exists()) {&#xA;                val retriever = MediaMetadataRetriever()&#xA;                retriever.setDataSource(requireActivity(), Uri.fromFile(file))&#xA;                val hasVideo =&#xA;                    retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_HAS_VIDEO)&#xA;                val isVideo = "yes" == hasVideo&#xA;                if (isVideo /*&amp;&amp; file.length() > 1000*/) {&#xA;                    Log.d("resp", videopaths.get(i))&#xA;                    video_list.add(videopaths.get(i))&#xA;                }&#xA;            }&#xA;        }&#xA;        try {&#xA;            val inMovies = arrayOfNulls<movie>(video_list.size)&#xA;            for (i in video_list.indices) {&#xA;                inMovies[i] = MovieCreator.build(video_list[i])&#xA;            }&#xA;            val videoTracks: MutableList<track> =&#xA;                LinkedList()&#xA;            val audioTracks: MutableList<track> =&#xA;                LinkedList()&#xA;            for (m in inMovies) {&#xA;                for (t in m!!.tracks) {&#xA;                    if (t.handler == "soun") {&#xA;                        audioTracks.add(t)&#xA;                    }&#xA;                    if (t.handler == "vide") {&#xA;                        videoTracks.add(t)&#xA;                    }&#xA;                }&#xA;            }&#xA;            val result = Movie()&#xA;            if (audioTracks.size > 0) {&#xA;                result.addTrack(AppendTrack(*audioTracks.toTypedArray()))&#xA;            }&#xA;            if (videoTracks.size > 0) {&#xA;                result.addTrack(AppendTrack(*videoTracks.toTypedArray()))&#xA;            }&#xA;            val out = DefaultMp4Builder().build(result)&#xA;            var outputFilePath: String? = null&#xA;            outputFilePath =  Variables.outputfile&#xA;&#xA;            /*if (audio != null) {&#xA;                Variables.outputfile&#xA;            } else {&#xA;                Variables.outputfile2&#xA;            }*/&#xA;&#xA;            val fos = FileOutputStream(File(outputFilePath))&#xA;            out.writeContainer(fos.channel)&#xA;            fos.close()&#xA;&#xA;            requireActivity().runOnUiThread {&#xA;                progressDialog.dismiss()&#xA;&#xA;                Merge_withAudio()&#xA;&#xA;                /* if (audio != null) else {&#xA;                     //Go_To_preview_Activity()&#xA;                 }*/&#xA;            }&#xA;        } catch (e: java.lang.Exception) {&#xA;        }&#xA;    }.start()&#xA;&#xA;    return true&#xA;}&#xA;</track></track></movie></string>

    &#xA;

    This will add the selected audio with the recorded video

    &#xA;

    fun Merge_withAudio() {&#xA;    val root = Environment.getExternalStorageDirectory().toString()&#xA;&#xA;    // Uri mediaPath = Uri.parse("android.resource://" &#x2B; getPackageName() &#x2B; "/" &#x2B; R.raw.file_copy);&#xA;    //String audio_file =Variables.app_folder&#x2B;Variables.SelectedAudio_AAC;&#xA;&#xA;    //String filename = "android.resource://" &#x2B; getPackageName() &#x2B; "/raw/file_copy.aac";&#xA;    val audio_file: String = audioLink!!&#xA;    Log.e("Merge ", audio_file)&#xA;    val video = "$root/output.mp4"&#xA;&#xA;    val bundle=Bundle()&#xA;    bundle.putString("FinalVideo", createdVideo?.absolutePath)&#xA;&#xA;    val merge_video_audio = Merge_Video_Audio(this, bundle, object : AsyncResponse {&#xA;        override fun processFinish(output: Bundle?) {&#xA;&#xA;            requireActivity().runOnUiThread {&#xA;                finalVideo = bundle.getString("FinalVideo")&#xA;                createdVideo = File(finalVideo)&#xA;&#xA;                Log.e("Final Path ", finalVideo)&#xA;&#xA;                createThumb {&#xA;                    setUpExoPlayer()&#xA;                }&#xA;            }&#xA;&#xA;        }&#xA;    })&#xA;    merge_video_audio.doInBackground(audio_file, video, createdVideo?.absolutePath)&#xA;}&#xA;&#xA;&#xA; public class Merge_Video_Audio extends AsyncTask {&#xA;&#xA;   ProgressDialog progressDialog;&#xA;   RecentCompletedVideoFragment context;&#xA;   public AsyncResponse delegate = null;&#xA;&#xA;&#xA;Bundle bundleValue;&#xA;&#xA;String audio,video,output;&#xA;&#xA;public Merge_Video_Audio(RecentCompletedVideoFragment context, Bundle bundle , AsyncResponse delegate ){&#xA;    this.context=context;&#xA;    this.bundleValue=bundle;&#xA;    this.delegate=delegate;&#xA;    progressDialog=new ProgressDialog(context.requireContext());&#xA;    progressDialog.setMessage("Please Wait...");&#xA;}&#xA;&#xA;@Override&#xA;protected void onPreExecute() {&#xA;    super.onPreExecute();&#xA;}&#xA;&#xA;@Override&#xA;public String doInBackground(String... strings) {&#xA;    try {&#xA;        progressDialog.show();&#xA;    }catch (Exception e){&#xA;&#xA;    }&#xA;     audio=strings[0];&#xA;     video=strings[1];&#xA;     output=strings[2];&#xA;&#xA;     Log.d("resp",audio&#x2B;"----"&#x2B;video&#x2B;"-----"&#x2B;output);&#xA;&#xA;    Thread thread = new Thread(runnable);&#xA;    thread.start();&#xA;&#xA;    return null;&#xA;}&#xA;&#xA;&#xA;@Override&#xA;protected void onPostExecute(String s) {&#xA;    super.onPostExecute(s);&#xA;    Log.e("On Post Execute ", "True");&#xA;&#xA;&#xA;}&#xA;&#xA;&#xA;   public void Go_To_preview_Activity(){&#xA;&#xA;    delegate.processFinish(bundleValue);&#xA;   }&#xA;&#xA;  public Track CropAudio(String videopath, Track fullAudio){&#xA;    try {&#xA;&#xA;        IsoFile isoFile = new IsoFile(videopath);&#xA;&#xA;        double lengthInSeconds = (double)&#xA;                isoFile.getMovieBox().getMovieHeaderBox().getDuration() /&#xA;                isoFile.getMovieBox().getMovieHeaderBox().getTimescale();&#xA;&#xA;&#xA;        Track audioTrack = (Track) fullAudio;&#xA;&#xA;&#xA;        double startTime1 = 0;&#xA;        double endTime1 = lengthInSeconds;&#xA;&#xA;&#xA;        long currentSample = 0;&#xA;        double currentTime = 0;&#xA;        double lastTime = -1;&#xA;        long startSample1 = -1;&#xA;        long endSample1 = -1;&#xA;&#xA;&#xA;        for (int i = 0; i &lt; audioTrack.getSampleDurations().length; i&#x2B;&#x2B;) {&#xA;&#xA;            long delta = audioTrack.getSampleDurations()[i];&#xA;&#xA;            if (currentTime > lastTime &amp;&amp; currentTime &lt;= startTime1) {&#xA;                // current sample is still before the new starttime&#xA;                startSample1 = currentSample;&#xA;            }&#xA;            if (currentTime > lastTime &amp;&amp; currentTime &lt;= endTime1) {&#xA;                // current sample is after the new start time and still before the new endtime&#xA;                endSample1 = currentSample;&#xA;            }&#xA;&#xA;            lastTime = currentTime;&#xA;            currentTime &#x2B;= (double) delta / (double) audioTrack.getTrackMetaData().getTimescale();&#xA;            currentSample&#x2B;&#x2B;;&#xA;        }&#xA;&#xA;        CroppedTrack cropperAacTrack = new CroppedTrack(fullAudio, startSample1, endSample1);&#xA;&#xA;        return cropperAacTrack;&#xA;&#xA;    } catch (IOException e) {&#xA;        e.printStackTrace();&#xA;    }&#xA;&#xA;    return fullAudio;&#xA;}&#xA;&#xA;&#xA;&#xA;  public Runnable runnable =new Runnable() {&#xA;    @Override&#xA;    public void run() {&#xA;&#xA;        try {&#xA;&#xA;            Movie m = MovieCreator.build(video);&#xA;&#xA;&#xA;            List nuTracks = new ArrayList&lt;>();&#xA;&#xA;            for (Track t : m.getTracks()) {&#xA;                if (!"soun".equals(t.getHandler())) {&#xA;&#xA;                    Log.e("Track  ",t.getName());&#xA;                    nuTracks.add(t);&#xA;                }&#xA;            }&#xA;&#xA;            Log.e("Path ",audio.toString());&#xA;&#xA;&#xA;            try {&#xA;                // Track nuAudio = new AACTrackImpl();&#xA;                Track nuAudio = new AACTrackImpl(new FileDataSourceImpl(audio));&#xA;&#xA;                Track crop_track = CropAudio(video, nuAudio);&#xA;&#xA;                nuTracks.add(crop_track);&#xA;&#xA;                m.setTracks(nuTracks);&#xA;&#xA;                Container mp4file = new DefaultMp4Builder().build(m);&#xA;&#xA;                FileChannel fc = new FileOutputStream(new File(output)).getChannel();&#xA;                mp4file.writeContainer(fc);&#xA;                fc.close();&#xA;&#xA;            }catch (FileNotFoundException fnfe){&#xA;                fnfe.printStackTrace();&#xA;            }catch(IOException ioe){&#xA;                ioe.printStackTrace();&#xA;           }&#xA;&#xA;&#xA;            try {&#xA;&#xA;                progressDialog.dismiss();&#xA;            }catch (Exception e){&#xA;                Log.d("resp",e.toString());&#xA;&#xA;            }finally {&#xA;                Go_To_preview_Activity();&#xA;&#xA;            }&#xA;&#xA;        } catch (IOException e) {&#xA;            e.printStackTrace();&#xA;            Log.d("resp",e.toString());&#xA;&#xA;        }&#xA;&#xA;    }&#xA;&#xA; };&#xA;&#xA; }&#xA;

    &#xA;

    This solution is also not working in all the devices.

    &#xA;

    Can anyone suggest where i am going wrong or any solution for it ?

    &#xA;