Recherche avancée

Médias (0)

Mot : - Tags -/presse-papier

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (53)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

Sur d’autres sites (5875)

  • Anomalie #4449 (Nouveau) : Taille d’image erronné des logos si un redimensionnement de l’image

    25 février 2020

    Pour le contexte, le problème est signalé là https://github.com/marcimat/bigup/issues/9 mais ne provient pas de Bigup.

    Pour reproduire :

    - définir dans mes_options.php les constantes :

    1. <span class="CodeRay"><span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_IMG_MAX_WIDTH</span><span class="delimiter">'</span></span>, <span class="integer">3000</span>);
    2. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_IMG_MAX_HEIGHT</span><span class="delimiter">'</span></span>, <span class="integer">1000</span>);
    3. </span>

    Télécharger

    - ajouter un plus grand logo (en SPIP 3.3+) sur un élément, par exemple un article
    - l’aperçu au retour retourne une image erronée, avec les dimensions de l’images d’origine (alors que l’image a réellement été redimensionnée sur le disque)
    - au rechargement la taille est affichée correctement, mais la miniature est toujours incorrecte

    Suppositions

    Il semblerait que les filtres largeur() et hauteur() utilisés par image_reduire, et par l’affichage du logo aient un cache qui enregistre la taille de l’image originale la première fois qu’ils sont appelés, mais si cette image est modifiée (réduite) ensuite, un appel ultérieur à ces fonctions retourne la valeur en cache.

    La réduction se fait dans verifier_taille_document_acceptable() de action/ajouter_documents.php du plugin medias, qui prend en comptel les constantes _IMG_MAX_WIDTH et _IMG_MAX_HEIGHT indiquées.

  • How add Data Stream into MXF(using mpeg2video) file with FFmpeg and C/C++

    26 mars 2019, par Helmuth Schmitz

    I’m a little bit stuck here trying create a MXF file
    with data stream on it. I have several MXF video files that contain
    this standard

    **1 Video Stream:
        Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 50000 kb/s, 29.9
    16 audio streams
        Audio: pcm_s24le, 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s
    1 Data Stream:
        Data: none**

    This data stream, contain personal data inside video file. I can
    open this stream and data is really there. Is all ok. But, when i try
    to create a file exactly like this, everytime i call "avformat_write_header"
    it returns an error.

    If i do comment the creation of this data streams the video file is succeffully
    created.

    If i change to "mpegts" with this data stream, the video file is also succeffully
    created.

    But, i can’t use mpets and i need this data stream.

    I know that is possible MXF with data stream cause i have this originals files
    that have this combination.

    So, i know that i missing something in my code.

    This is the way i create this Data Stream :

    void CFFmpegVideoWriter::addDataStream(EOutputStream *ost, AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id)
       {
           AVCodecParameters *par;

           ost->stream = avformat_new_stream(oc, NULL);
           if (ost->stream == NULL)
           {
               fprintf(stderr, "OOooohhh man: avformat_new_stream() failed.\n");
               return;
           }

           par = ost->stream->codecpar;
           ost->stream->index = 17;
           par->codec_id = AV_CODEC_ID_NONE;
           par->codec_type = AVMEDIA_TYPE_DATA;

           ost->stream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
       }

    the file openning is this :

    CFFMpegVideoWriter::CFFMpegVideoWriter(QString outputfilename) : QThread()
    {
       av_register_all();
       avcodec_register_all();

       isOpen = false;
       shouldClose = false;

       frameIndex = 0;

    #ifdef __linux__
       QByteArray bFilename = outputfilename.toUtf8();
    #else
       QByteArray bFilename = outputfilename.toLatin1();
    #endif

       const char* filename = bFilename.data();

       codecContext = NULL;

       //encontra o formato desejado...
       outputFormat = av_guess_format("mp2v", filename, nullptr);
       if (!outputFormat)
       {
           qDebug("Could not find suitable output format\n");
           return;
       }

       //encontra o codec...
       codec = avcodec_find_encoder(outputFormat->video_codec);
       if (!codec)
       {
           qDebug( "Codec not found\n");
           return;
       }

       //aloca o contexto do codec...
       codecContext = avcodec_alloc_context3(codec);
       codecContext->field_order = AV_FIELD_TT;
       codecContext->profile = FF_PROFILE_MPEG2_422;

       //aloca o contexto do formato...
       formatContext = avformat_alloc_context();
       formatContext->oformat = outputFormat;

       //aloca o contexto da midia de saida...
       avformat_alloc_output_context2(&amp;formatContext, NULL, NULL, filename);
       if (!formatContext)
       {
           qDebug("Erro");
           return;
       }

       videoStream.tmp_frame = NULL;
       videoStream.swr_ctx = NULL;

       //adiciona a stream de video...
       if (outputFormat->video_codec != AV_CODEC_ID_NONE)
       {
           addVideoStream(&amp;videoStream, formatContext, &amp;video_codec, outputFormat->video_codec);      
       }

       //adiciona as 16 streams de audio...
       if (outputFormat->audio_codec != AV_CODEC_ID_NONE)
       {
           for (int i = 0; i &lt; 16; i++)
           {
               addAudioStream(&amp;audioStream[i], formatContext, &amp;audio_codec, outputFormat->audio_codec);
           }      
       }

       addDataStream(&amp;datastream, formatContext, &amp;video_codec, outputFormat->video_codec);    

       videoStream.sws_ctx = NULL;
       for (int i = 0; i &lt; 16; i++)
       {
           audioStream[i].sws_ctx = NULL;
       }  
       opt = NULL;


       //carreca o codec de video para stream de video...      
       initVideoCodec(formatContext, video_codec, &amp;videoStream, opt);


       //carrega o codec de audio para stream de audio...s
       for (int i = 0; i &lt; 16; i++)
       {
           initAudioCodec(formatContext, audio_codec, &amp;audioStream[i], opt);
       }


       av_dump_format(formatContext, 0, filename, 1);

       //abrea o arquivo de saida..
       if (!(outputFormat->flags &amp; AVFMT_NOFILE))
       {
           ret = avio_open(&amp;formatContext->pb, filename, AVIO_FLAG_WRITE);
           if (ret &lt; 0)
           {
               qDebug("Could not open'%s", filename);
               return;
           }
       }

       //escreve o cabecalho do arquivo...
       ret = avformat_write_header(formatContext, &amp;opt);
       if (ret &lt; 0)
       {
           qDebug("Error occurred when opening output file");
           return;
       }

       isOpen = true;

       QThread::start();
    }

    The code always fails at "avformat_write_header" call.

    But if i remove "datastream" or change it to mpegts everything runs fine.

    Any ideia of what am i doing wrong here ?

    Thanks for reading this.

    Helmuth

  • WARN : Tried to pass invalid video frame, marking as broken : Your frame has data type int64, but we require uint8

    5 septembre 2019, par Tavo Diaz

    I am doing some Udemy AI courses and came across with one that "teaches" a bidimensional cheetah how to walk. I was doing the exercises on my computer, but it takes too much time. I decided to use Google Cloud to run the code and see the results some hours after. Nevertheless, when I run the code I get the following error " WARN : Tried to pass
    invalid video frame, marking as broken : Your frame has data type int64, but we require uint8 (i.e. RGB values from 0-255)".

    After the code is executed, I see into the folder and I don’t see any videos (just the meta info).

    Some more info (if it helps) :
    I have a 1 CPU (4g), SSD Ubuntu 16.04 LTS

    I have not tried anything yet to solve it because I don´t know what to try. Im looking for solutions on the web, but nothing I could try.

    This is the code

    import os
    import numpy as np
    import gym
    from gym import wrappers
    import pybullet_envs


    class Hp():
       def __init__(self):
           self.nb_steps = 1000
           self.episode_lenght =   1000
           self.learning_rate = 0.02
           self.nb_directions = 32
           self.nb_best_directions = 32
           assert self.nb_best_directions &lt;= self.nb_directions
           self.noise = 0.03
           self.seed = 1
           self.env_name = 'HalfCheetahBulletEnv-v0'


    class Normalizer():
       def __init__(self, nb_inputs):
           self.n = np.zeros(nb_inputs)
           self.mean = np.zeros(nb_inputs)
           self.mean_diff = np.zeros(nb_inputs)
           self.var = np.zeros(nb_inputs)

       def observe(self, x):
           self.n += 1.
           last_mean = self.mean.copy()
           self.mean += (x - self.mean) / self.n
           #abajo es el online numerator update
           self.mean_diff += (x - last_mean) * (x - self.mean)
           #abajo online computation de la varianza
           self.var = (self.mean_diff / self.n).clip(min = 1e-2)  

       def normalize(self, inputs):
           obs_mean = self.mean
           obs_std = np.sqrt(self.var)
           return (inputs - obs_mean) / obs_std

    class Policy():
       def __init__(self, input_size, output_size):
           self.theta = np.zeros((output_size, input_size))

       def evaluate(self, input, delta = None, direction = None):
           if direction is None:
               return self.theta.dot(input)
           elif direction == 'positive':
               return (self.theta + hp.noise * delta).dot(input)
           else:
               return (self.theta - hp.noise * delta).dot(input)

       def sample_deltas(self):
           return [np.random.randn(*self.theta.shape) for _ in range(hp.nb_directions)]

       def update (self, rollouts, sigma_r):
           step = np.zeros(self.theta.shape)
           for r_pos, r_neg, d in rollouts:
               step += (r_pos - r_neg) * d
           self.theta += hp.learning_rate / (hp.nb_best_directions * sigma_r) * step


    def explore(env, normalizer, policy, direction = None, delta = None):
       state = env.reset()
       done = False
       num_plays = 0.
       #abajo puede ser promedio de las rewards
       sum_rewards = 0
       while not done and num_plays &lt; hp.episode_lenght:
           normalizer.observe(state)
           state = normalizer.normalize(state)
           action = policy.evaluate(state, delta, direction)
           state, reward, done, _ = env.step(action)
           reward = max(min(reward, 1), -1)
           #abajo sería poner un promedio
           sum_rewards += reward
           num_plays += 1
       return sum_rewards

    def train (env, policy, normalizer, hp):
       for step in range(hp.nb_steps):
           #iniciar las perturbaciones deltas y los rewards positivos/negativos
           deltas = policy.sample_deltas()
           positive_rewards = [0] * hp.nb_directions
           negative_rewards = [0] * hp.nb_directions
           #sacar las rewards en la dirección positiva
           for k in range(hp.nb_directions):
               positive_rewards[k] = explore(env, normalizer, policy, direction = 'positive', delta = deltas[k])
           #sacar las rewards en dirección negativo
           for k in range(hp.nb_directions):
               negative_rewards[k] = explore(env, normalizer, policy, direction = 'negative', delta = deltas[k])
           #sacar todas las rewards para sacar la desvest
           all_rewards = np.array(positive_rewards + negative_rewards)
           sigma_r = all_rewards.std()
           #acomodar los rollauts por el max (r_pos, r_neg) y seleccionar la mejor dirección
           scores = {k:max(r_pos, r_neg) for k, (r_pos, r_neg) in enumerate(zip(positive_rewards, negative_rewards))}
           order = sorted(scores.keys(), key = lambda x:scores[x])[:hp.nb_best_directions]
           rollouts = [(positive_rewards[k], negative_rewards[k], deltas[k]) for k in order]
           #actualizar policy
           policy.update (rollouts, sigma_r)
           #poner el final reward del policy luego del update
           reward_evaluation = explore (env, normalizer, policy)
           print('Paso: ', step, 'Lejania: ', reward_evaluation)

    def mkdir(base, name):
       path = os.path.join(base, name)
       if not os.path.exists(path):
           os.makedirs(path)
       return path
    work_dir = mkdir('exp', 'brs')
    monitor_dir = mkdir(work_dir, 'monitor')

    hp = Hp()
    np.random.seed(hp.seed)
    env = gym.make(hp.env_name)
    env = wrappers.Monitor(env, monitor_dir, force = True)
    nb_inputs = env.observation_space.shape[0]
    nb_outputs = env.action_space.shape[0]
    policy = Policy(nb_inputs, nb_outputs)
    normalizer = Normalizer(nb_inputs)
    train(env, policy, normalizer, hp)