Recherche avancée

Médias (0)

Mot : - Tags -/xml-rpc

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

Autres articles (60)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-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

  • Submit bugs and patches

    13 avril 2011

    Unfortunately 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 (8159)

  • Encoding Exception during Transcode with audio files

    6 mai 2016, par Hakop Zakaryan

    I am attempting to transcode using an FFMPEG Wrapper Library called JAVE on Mac OSX 10.11.3 using Eclipse 4.50

    My Converter.java class looks something like this :

    package matador;

    import it.sauronsoftware.jave.AudioAttributes;
    import it.sauronsoftware.jave.EncodingAttributes;
    import it.sauronsoftware.jave.EncoderException;
    import it.sauronsoftware.jave.InputFormatException;
    import it.sauronsoftware.jave.Encoder;
    import java.io.*;

    public class Converter {

    public static void main(String[] args) throws InputFormatException, EncoderException {

       File source = new File("Classic.m4a");
       File target = new File("target.mp3");

       AudioAttributes audio = new AudioAttributes();
       audio.setCodec("libmp3lame");
       audio.setBitRate(new Integer(128000));
       audio.setChannels(new Integer(2));
       audio.setSamplingRate(new Integer(44100));

       EncodingAttributes attrs = new EncodingAttributes();
       attrs.setFormat("mp3");
       attrs.setAudioAttributes(audio);

       Encoder encoder = new Encoder(new MyFFMPEGExecutableLocator());
       try {
       encoder.encode(source, target, attrs, null);
       } catch (IllegalArgumentException e) {

           e.printStackTrace();
       } catch (InputFormatException e) {

           e.printStackTrace();
       } catch (EncoderException e) {

           e.printStackTrace();
       }

    }

    }

    The problem I am running into is that with specific audio files (regardless of format) give me this EncoderException :

    it.sauronsoftware.jave.EncoderException:   Metadata:
    at it.sauronsoftware.jave.Encoder.encode(Encoder.java:863)
    at matador.Converter.main(Converter.java:32)

    I have looked through Encoder.java and the EncoderException on line 863 is this specific code :

    } else if (!line.startsWith("Output #0")) {
    throw new EncoderException(line);

    I have been unable to figure out why this may be occurring but specific audio files (WAV/AAC/etc) do encode yet a majority just give this exception.

    Thank you for the help !

    Edit : As per request for possibly being able to help me further, here is the entirety of the Encoder.java code :

    package it.sauronsoftware.jave;

    import java.io.File;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.ArrayList;
    import java.util.Hashtable;
    import java.util.StringTokenizer;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;

    public class Encoder {

    private static final Pattern FORMAT_PATTERN = Pattern
           .compile("^\\s*([D ])([E ])\\s+([\\w,]+)\\s+.+$");

    private static final Pattern ENCODER_DECODER_PATTERN = Pattern.compile(
           "^\\s*([D ])([E ])([AVS]).{3}\\s+(.+)$", Pattern.CASE_INSENSITIVE);

    private static final Pattern PROGRESS_INFO_PATTERN = Pattern.compile(
           "\\s*(\\w+)\\s*=\\s*(\\S+)\\s*", Pattern.CASE_INSENSITIVE);

    private static final Pattern SIZE_PATTERN = Pattern.compile(
           "(\\d+)x(\\d+)", Pattern.CASE_INSENSITIVE);

    private static final Pattern FRAME_RATE_PATTERN = Pattern.compile(
           "([\\d.]+)\\s+(?:fps|tb\\(r\\))", Pattern.CASE_INSENSITIVE);

    private static final Pattern BIT_RATE_PATTERN = Pattern.compile(
           "(\\d+)\\s+kb/s", Pattern.CASE_INSENSITIVE);

    private static final Pattern SAMPLING_RATE_PATTERN = Pattern.compile(
           "(\\d+)\\s+Hz", Pattern.CASE_INSENSITIVE);

    private static final Pattern CHANNELS_PATTERN = Pattern.compile(
           "(mono|stereo)", Pattern.CASE_INSENSITIVE);

    private static final Pattern SUCCESS_PATTERN = Pattern.compile(
           "^\\s*video\\:\\S+\\s+audio\\:\\S+\\s+global headers\\:\\S+.*$",
           Pattern.CASE_INSENSITIVE);

    private FFMPEGLocator locator;

    public Encoder() {
       this.locator = new DefaultFFMPEGLocator();
    }

    public Encoder(FFMPEGLocator locator) {
       this.locator = locator;
    }

    public String[] getAudioDecoders() throws EncoderException {
       ArrayList res = new ArrayList();
       FFMPEGExecutor ffmpeg = locator.createExecutor();
       ffmpeg.addArgument("-formats");
       try {
           ffmpeg.execute();
           RBufferedReader reader = null;
           reader = new RBufferedReader(new InputStreamReader(ffmpeg
                   .getInputStream()));
           String line;
           boolean evaluate = false;
           while ((line = reader.readLine()) != null) {
               if (line.trim().length() == 0) {
                   continue;
               }
               if (evaluate) {
                   Matcher matcher = ENCODER_DECODER_PATTERN.matcher(line);
                   if (matcher.matches()) {
                       String decoderFlag = matcher.group(1);
                       String audioVideoFlag = matcher.group(3);
                       if ("D".equals(decoderFlag)
                               && "A".equals(audioVideoFlag)) {
                           String name = matcher.group(4);
                           res.add(name);
                       }
                   } else {
                       break;
                   }
               } else if (line.trim().equals("Codecs:")) {
                   evaluate = true;
               }
           }
       } catch (IOException e) {
           throw new EncoderException(e);
       } finally {
           ffmpeg.destroy();
       }
       int size = res.size();
       String[] ret = new String[size];
       for (int i = 0; i < size; i++) {
           ret[i] = (String) res.get(i);
       }
       return ret;
    }

    public String[] getAudioEncoders() throws EncoderException {
       ArrayList res = new ArrayList();
       FFMPEGExecutor ffmpeg = locator.createExecutor();
       ffmpeg.addArgument("-formats");
       try {
           ffmpeg.execute();
           RBufferedReader reader = null;
           reader = new RBufferedReader(new InputStreamReader(ffmpeg
                   .getInputStream()));
           String line;
           boolean evaluate = false;
           while ((line = reader.readLine()) != null) {
               if (line.trim().length() == 0) {
                   continue;
               }
               if (evaluate) {
                   Matcher matcher = ENCODER_DECODER_PATTERN.matcher(line);
                   if (matcher.matches()) {
                       String encoderFlag = matcher.group(2);
                       String audioVideoFlag = matcher.group(3);
                       if ("E".equals(encoderFlag)
                               && "A".equals(audioVideoFlag)) {
                           String name = matcher.group(4);
                           res.add(name);
                       }
                   } else {
                       break;
                   }
               } else if (line.trim().equals("Codecs:")) {
                   evaluate = true;
               }
           }
       } catch (IOException e) {
           throw new EncoderException(e);
       } finally {
           ffmpeg.destroy();
       }
       int size = res.size();
       String[] ret = new String[size];
       for (int i = 0; i < size; i++) {
           ret[i] = (String) res.get(i);
       }
       return ret;
    }

    public String[] getVideoDecoders() throws EncoderException {
       ArrayList res = new ArrayList();
       FFMPEGExecutor ffmpeg = locator.createExecutor();
       ffmpeg.addArgument("-formats");
       try {
           ffmpeg.execute();
           RBufferedReader reader = null;
           reader = new RBufferedReader(new InputStreamReader(ffmpeg
                   .getInputStream()));
           String line;
           boolean evaluate = false;
           while ((line = reader.readLine()) != null) {
               if (line.trim().length() == 0) {
                   continue;
               }
               if (evaluate) {
                   Matcher matcher = ENCODER_DECODER_PATTERN.matcher(line);
                   if (matcher.matches()) {
                       String decoderFlag = matcher.group(1);
                       String audioVideoFlag = matcher.group(3);
                       if ("D".equals(decoderFlag)
                               && "V".equals(audioVideoFlag)) {
                           String name = matcher.group(4);
                           res.add(name);
                       }
                   } else {
                       break;
                   }
               } else if (line.trim().equals("Codecs:")) {
                   evaluate = true;
               }
           }
       } catch (IOException e) {
           throw new EncoderException(e);
       } finally {
           ffmpeg.destroy();
       }
       int size = res.size();
       String[] ret = new String[size];
       for (int i = 0; i < size; i++) {
           ret[i] = (String) res.get(i);
       }
       return ret;
    }

    public String[] getVideoEncoders() throws EncoderException {
       ArrayList res = new ArrayList();
       FFMPEGExecutor ffmpeg = locator.createExecutor();
       ffmpeg.addArgument("-formats");
       try {
           ffmpeg.execute();
           RBufferedReader reader = null;
           reader = new RBufferedReader(new InputStreamReader(ffmpeg
                   .getInputStream()));
           String line;
           boolean evaluate = false;
           while ((line = reader.readLine()) != null) {
               if (line.trim().length() == 0) {
                   continue;
               }
               if (evaluate) {
                   Matcher matcher = ENCODER_DECODER_PATTERN.matcher(line);
                   if (matcher.matches()) {
                       String encoderFlag = matcher.group(2);
                       String audioVideoFlag = matcher.group(3);
                       if ("E".equals(encoderFlag)
                               && "V".equals(audioVideoFlag)) {
                           String name = matcher.group(4);
                           res.add(name);
                       }
                   } else {
                       break;
                   }
               } else if (line.trim().equals("Codecs:")) {
                   evaluate = true;
               }
           }
       } catch (IOException e) {
           throw new EncoderException(e);
       } finally {
           ffmpeg.destroy();
       }
       int size = res.size();
       String[] ret = new String[size];
       for (int i = 0; i < size; i++) {
           ret[i] = (String) res.get(i);
       }
       return ret;
    }

    public String[] getSupportedEncodingFormats() throws EncoderException {
       ArrayList res = new ArrayList();
       FFMPEGExecutor ffmpeg = locator.createExecutor();
       ffmpeg.addArgument("-formats");
       try {
           ffmpeg.execute();
           RBufferedReader reader = null;
           reader = new RBufferedReader(new InputStreamReader(ffmpeg
                   .getInputStream()));
           String line;
           boolean evaluate = false;
           while ((line = reader.readLine()) != null) {
               if (line.trim().length() == 0) {
                   continue;
               }
               if (evaluate) {
                   Matcher matcher = FORMAT_PATTERN.matcher(line);
                   if (matcher.matches()) {
                       String encoderFlag = matcher.group(2);
                       if ("E".equals(encoderFlag)) {
                           String aux = matcher.group(3);
                           StringTokenizer st = new StringTokenizer(aux, ",");
                           while (st.hasMoreTokens()) {
                               String token = st.nextToken().trim();
                               if (!res.contains(token)) {
                                   res.add(token);
                               }
                           }
                       }
                   } else {
                       break;
                   }
               } else if (line.trim().equals("File formats:")) {
                   evaluate = true;
               }
           }
       } catch (IOException e) {
           throw new EncoderException(e);
       } finally {
           ffmpeg.destroy();
       }
       int size = res.size();
       String[] ret = new String[size];
       for (int i = 0; i < size; i++) {
           ret[i] = (String) res.get(i);
       }
       return ret;
    }

    public String[] getSupportedDecodingFormats() throws EncoderException {
       ArrayList res = new ArrayList();
       FFMPEGExecutor ffmpeg = locator.createExecutor();
       ffmpeg.addArgument("-formats");
       try {
           ffmpeg.execute();
           RBufferedReader reader = null;
           reader = new RBufferedReader(new InputStreamReader(ffmpeg
                   .getInputStream()));
           String line;
           boolean evaluate = false;
           while ((line = reader.readLine()) != null) {
               if (line.trim().length() == 0) {
                   continue;
               }
               if (evaluate) {
                   Matcher matcher = FORMAT_PATTERN.matcher(line);
                   if (matcher.matches()) {
                       String decoderFlag = matcher.group(1);
                       if ("D".equals(decoderFlag)) {
                           String aux = matcher.group(3);
                           StringTokenizer st = new StringTokenizer(aux, ",");
                           while (st.hasMoreTokens()) {
                               String token = st.nextToken().trim();
                               if (!res.contains(token)) {
                                   res.add(token);
                               }
                           }
                       }
                   } else {
                       break;
                   }
               } else if (line.trim().equals("File formats:")) {
                   evaluate = true;
               }
           }
       } catch (IOException e) {
           throw new EncoderException(e);
       } finally {
           ffmpeg.destroy();
       }
       int size = res.size();
       String[] ret = new String[size];
       for (int i = 0; i < size; i++) {
           ret[i] = (String) res.get(i);
       }
       return ret;
    }

    public MultimediaInfo getInfo(File source) throws InputFormatException,
           EncoderException {
       FFMPEGExecutor ffmpeg = locator.createExecutor();
       ffmpeg.addArgument("-i");
       ffmpeg.addArgument(source.getAbsolutePath());
       try {
           ffmpeg.execute();
       } catch (IOException e) {
           throw new EncoderException(e);
       }
       try {
           RBufferedReader reader = null;
           reader = new RBufferedReader(new InputStreamReader(ffmpeg
                   .getErrorStream()));
           return parseMultimediaInfo(source, reader);
       } finally {
           ffmpeg.destroy();
       }
    }

    private MultimediaInfo parseMultimediaInfo(File source,
           RBufferedReader reader) throws InputFormatException,
           EncoderException {
       Pattern p1 = Pattern.compile("^\\s*Input #0, (\\w+).+$\\s*",
               Pattern.CASE_INSENSITIVE);
       Pattern p2 = Pattern.compile(
               "^\\s*Duration: (\\d\\d):(\\d\\d):(\\d\\d)\\.(\\d).*$",
               Pattern.CASE_INSENSITIVE);
       Pattern p3 = Pattern.compile(
               "^\\s*Stream #\\S+: ((?:Audio)|(?:Video)|(?:Data)): (.*)\\s*$",
               Pattern.CASE_INSENSITIVE);
       MultimediaInfo info = null;
       try {
           int step = 0;
           while (true) {
               String line = reader.readLine();
               if (line == null) {
                   break;
               }
               if (step == 0) {
                   String token = source.getAbsolutePath() + ": ";
                   if (line.startsWith(token)) {
                       String message = line.substring(token.length());
                       throw new InputFormatException(message);
                   }
                   Matcher m = p1.matcher(line);
                   if (m.matches()) {
                       String format = m.group(1);
                       info = new MultimediaInfo();
                       info.setFormat(format);
                       step++;
                   }
               } else if (step == 1) {
                   Matcher m = p2.matcher(line);
                   if (m.matches()) {
                       long hours = Integer.parseInt(m.group(1));
                       long minutes = Integer.parseInt(m.group(2));
                       long seconds = Integer.parseInt(m.group(3));
                       long dec = Integer.parseInt(m.group(4));
                       long duration = (dec * 100L) + (seconds * 1000L)
                               + (minutes * 60L * 1000L)
                               + (hours * 60L * 60L * 1000L);
                       info.setDuration(duration);
                       step++;
                   } else {
                       step = 3;
                   }
               } else if (step == 2) {
                   Matcher m = p3.matcher(line);
                   if (m.matches()) {
                       String type = m.group(1);
                       String specs = m.group(2);
                       if ("Video".equalsIgnoreCase(type)) {
                           VideoInfo video = new VideoInfo();
                           StringTokenizer st = new StringTokenizer(specs, ",");
                           for (int i = 0; st.hasMoreTokens(); i++) {
                               String token = st.nextToken().trim();
                               if (i == 0) {
                                   video.setDecoder(token);
                               } else {
                                   boolean parsed = false;
                                   // Video size.
                                   Matcher m2 = SIZE_PATTERN.matcher(token);
                                   if (!parsed && m2.find()) {
                                       int width = Integer.parseInt(m2
                                               .group(1));
                                       int height = Integer.parseInt(m2
                                               .group(2));
                                       video.setSize(new VideoSize(width,
                                               height));
                                       parsed = true;
                                   }
                                   // Frame rate.
                                   m2 = FRAME_RATE_PATTERN.matcher(token);
                                   if (!parsed && m2.find()) {
                                       try {
                                           float frameRate = Float
                                                   .parseFloat(m2.group(1));
                                           video.setFrameRate(frameRate);
                                       } catch (NumberFormatException e) {
                                           ;
                                       }
                                       parsed = true;
                                   }
                                   // Bit rate.
                                   m2 = BIT_RATE_PATTERN.matcher(token);
                                   if (!parsed && m2.find()) {
                                       int bitRate = Integer.parseInt(m2
                                               .group(1));
                                       video.setBitRate(bitRate);
                                       parsed = true;
                                   }
                               }
                           }
                           info.setVideo(video);
                       } else if ("Audio".equalsIgnoreCase(type)) {
                           AudioInfo audio = new AudioInfo();
                           StringTokenizer st = new StringTokenizer(specs, ",");
                           for (int i = 0; st.hasMoreTokens(); i++) {
                               String token = st.nextToken().trim();
                               if (i == 0) {
                                   audio.setDecoder(token);
                               } else {
                                   boolean parsed = false;
                                   // Sampling rate.
                                   Matcher m2 = SAMPLING_RATE_PATTERN
                                           .matcher(token);
                                   if (!parsed && m2.find()) {
                                       int samplingRate = Integer.parseInt(m2
                                               .group(1));
                                       audio.setSamplingRate(samplingRate);
                                       parsed = true;
                                   }
                                   // Channels.
                                   m2 = CHANNELS_PATTERN.matcher(token);
                                   if (!parsed && m2.find()) {
                                       String ms = m2.group(1);
                                       if ("mono".equalsIgnoreCase(ms)) {
                                           audio.setChannels(1);
                                       } else if ("stereo"
                                               .equalsIgnoreCase(ms)) {
                                           audio.setChannels(2);
                                       }
                                       parsed = true;
                                   }
                                   // Bit rate.
                                   m2 = BIT_RATE_PATTERN.matcher(token);
                                   if (!parsed && m2.find()) {
                                       int bitRate = Integer.parseInt(m2
                                               .group(1));
                                       audio.setBitRate(bitRate);
                                       parsed = true;
                                   }
                               }
                           }
                           info.setAudio(audio);
                       }
                   } else {
                       step = 3;
                   }
               }
               if (step == 3) {
                   reader.reinsertLine(line);
                   break;
               }
           }
       } catch (IOException e) {
           throw new EncoderException(e);
       }
       if (info == null) {
           throw new InputFormatException();
       }
       return info;
    }

    private Hashtable parseProgressInfoLine(String line) {
       Hashtable table = null;
       Matcher m = PROGRESS_INFO_PATTERN.matcher(line);
       while (m.find()) {
           if (table == null) {
               table = new Hashtable();
           }
           String key = m.group(1);
           String value = m.group(2);
           table.put(key, value);
       }
       return table;
    }

    public void encode(File source, File target, EncodingAttributes attributes)
           throws IllegalArgumentException, InputFormatException,
           EncoderException {
       encode(source, target, attributes, null);
    }

    public void encode(File source, File target, EncodingAttributes attributes,
           EncoderProgressListener listener) throws IllegalArgumentException,
           InputFormatException, EncoderException {
       String formatAttribute = attributes.getFormat();
       Float offsetAttribute = attributes.getOffset();
       Float durationAttribute = attributes.getDuration();
       AudioAttributes audioAttributes = attributes.getAudioAttributes();
       VideoAttributes videoAttributes = attributes.getVideoAttributes();
       if (audioAttributes == null && videoAttributes == null) {
           throw new IllegalArgumentException(
                   "Both audio and video attributes are null");
       }
       target = target.getAbsoluteFile();
       target.getParentFile().mkdirs();
       FFMPEGExecutor ffmpeg = locator.createExecutor();
       if (offsetAttribute != null) {
           ffmpeg.addArgument("-ss");
           ffmpeg.addArgument(String.valueOf(offsetAttribute.floatValue()));
       }
       ffmpeg.addArgument("-i");
       ffmpeg.addArgument(source.getAbsolutePath());
       if (durationAttribute != null) {
           ffmpeg.addArgument("-t");
           ffmpeg.addArgument(String.valueOf(durationAttribute.floatValue()));
       }
       if (videoAttributes == null) {
           ffmpeg.addArgument("-vn");
       } else {
           String codec = videoAttributes.getCodec();
           if (codec != null) {
               ffmpeg.addArgument("-vcodec");
               ffmpeg.addArgument(codec);
           }
           String tag = videoAttributes.getTag();
           if (tag != null) {
               ffmpeg.addArgument("-vtag");
               ffmpeg.addArgument(tag);
           }
           Integer bitRate = videoAttributes.getBitRate();
           if (bitRate != null) {
               ffmpeg.addArgument("-b");
               ffmpeg.addArgument(String.valueOf(bitRate.intValue()));
           }
           Integer frameRate = videoAttributes.getFrameRate();
           if (frameRate != null) {
               ffmpeg.addArgument("-r");
               ffmpeg.addArgument(String.valueOf(frameRate.intValue()));
           }
           VideoSize size = videoAttributes.getSize();
           if (size != null) {
               ffmpeg.addArgument("-s");
               ffmpeg.addArgument(String.valueOf(size.getWidth()) + "x"
                       + String.valueOf(size.getHeight()));
           }
       }
       if (audioAttributes == null) {
           ffmpeg.addArgument("-an");
       } else {
           String codec = audioAttributes.getCodec();
           if (codec != null) {
               ffmpeg.addArgument("-acodec");
               ffmpeg.addArgument(codec);
           }
           Integer bitRate = audioAttributes.getBitRate();
           if (bitRate != null) {
               ffmpeg.addArgument("-ab");
               ffmpeg.addArgument(String.valueOf(bitRate.intValue()));
           }
           Integer channels = audioAttributes.getChannels();
           if (channels != null) {
               ffmpeg.addArgument("-ac");
               ffmpeg.addArgument(String.valueOf(channels.intValue()));
           }
           Integer samplingRate = audioAttributes.getSamplingRate();
           if (samplingRate != null) {
               ffmpeg.addArgument("-ar");
               ffmpeg.addArgument(String.valueOf(samplingRate.intValue()));
           }
           Integer volume = audioAttributes.getVolume();
           if (volume != null) {
               ffmpeg.addArgument("-vol");
               ffmpeg.addArgument(String.valueOf(volume.intValue()));
           }
       }
       ffmpeg.addArgument("-f");
       ffmpeg.addArgument(formatAttribute);
       ffmpeg.addArgument("-y");
       ffmpeg.addArgument(target.getAbsolutePath());
       try {
           ffmpeg.execute();
       } catch (IOException e) {
           throw new EncoderException(e);
       }
       try {
           String lastWarning = null;
           long duration;
           long progress = 0;
           RBufferedReader reader = null;
           reader = new RBufferedReader(new InputStreamReader(ffmpeg
                   .getErrorStream()));
           MultimediaInfo info = parseMultimediaInfo(source, reader);
           if (durationAttribute != null) {
               duration = (long) Math
                       .round((durationAttribute.floatValue() * 1000L));
           } else {
               duration = info.getDuration();
               if (offsetAttribute != null) {
                   duration -= (long) Math
                           .round((offsetAttribute.floatValue() * 1000L));
               }
           }
           if (listener != null) {
               listener.sourceInfo(info);
           }
           int step = 0;
           String line;
           while ((line = reader.readLine()) != null) {
               if (step == 0) {
                   if (line.startsWith("WARNING: ")) {
                       if (listener != null) {
                           listener.message(line);
                       }
                   } else if (!line.startsWith("Output #0")) {
                       throw new EncoderException(line);
                   } else {
                       step++;
                   }
               } else if (step == 1) {
                   if (!line.startsWith("  ")) {
                       step++;
                   }
               }
               if (step == 2) {
                   if (!line.startsWith("Stream mapping:")) {
                       throw new EncoderException(line);
                   } else {
                       step++;
                   }
               } else if (step == 3) {
                   if (!line.startsWith("  ")) {
                       step++;
                   }
               }
               if (step == 4) {
                   line = line.trim();
                   if (line.length() > 0) {
                       Hashtable table = parseProgressInfoLine(line);
                       if (table == null) {
                           if (listener != null) {
                               listener.message(line);
                           }
                           lastWarning = line;
                       } else {
                           if (listener != null) {
                               String time = (String) table.get("time");
                               if (time != null) {
                                   int dot = time.indexOf('.');
                                   if (dot > 0 && dot == time.length() - 2
                                           && duration > 0) {
                                       String p1 = time.substring(0, dot);
                                       String p2 = time.substring(dot + 1);
                                       try {
                                           long i1 = Long.parseLong(p1);
                                           long i2 = Long.parseLong(p2);
                                           progress = (i1 * 1000L)
                                                   + (i2 * 100L);
                                           int perm = (int) Math
                                                   .round((double) (progress * 1000L)
                                                           / (double) duration);
                                           if (perm > 1000) {
                                               perm = 1000;kMDItemAudioEncodingApplication = "Lavf57.26.100"
                                           }
                                           listener.progress(perm);
                                       } catch (NumberFormatException e) {
                                           ;
                                       }
                                   }
                               }
                           }
                           lastWarning = null;
                       }
                   }
               }
           }
           if (lastWarning != null) {
               if (!SUCCESS_PATTERN.matcher(lastWarning).matches()) {
                   throw new EncoderException(lastWarning);
               }
           }
       } catch (IOException e) {
           throw new EncoderException(e);
       } finally {
           ffmpeg.destroy();
       }
    }

    }
  • Anomalie #3607 : Problème de compatibilité avec mysql 5.7 pour SPIP 3.1

    26 avril 2016, par Guillaume Fahrner

    Le format est correct, la valeur ne convient par contre pas. La changer parait suffisant :

    https://github.com/concrete5/concrete5/issues/3185 :

    The DATETIME type is used for values that contain both date and time parts. MySQL retrieves and displays DATETIME values in ’YYYY-MM-DD HH:MM:SS’ format. The supported range is ’1000-01-01 00:00:00’ to ’9999-12-31 23:59:59’.

    Per http://dev.mysql.com/doc/refman/5.7/en/datetime.html

  • Audioqueue try to read ADPCM sound

    4 septembre 2013, par Kamax

    I try to read a .asf stream with FFMPEG and the audio part is ADPCM IMA WAV codec.

    The sound i hear when i hear something is only noise. I suppose my AudioStreamBasicDescription are wrong. How can i get the correct values ?

    From ffprobe i have this :

    [STREAM]
    index=1
    codec_name=adpcm_ima_wav
    codec_long_name=ADPCM IMA WAV
    codec_type=audio
    codec_time_base=1/8000
    codec_tag_string=[17][0][0][0]
    codec_tag=0x0011
    sample_rate=8000.000000
    channels=1
    bits_per_sample=4
    r_frame_rate=0/0
    avg_frame_rate=250/41
    time_base=1/1000
    start_time=0.000000
    duration=N/A
    [/STREAM]

    and

    Stream #0.1: Audio: adpcm_ima_wav, 8000 Hz, 1 channels, s16, 32 kb/s

    my code for the moment is :

    asbd.mSampleRate = 8000;
    asbd.mFormatID = kAudioFormatAppleIMA4;
    asbd.mBytesPerPacket = 34;
    asbd.mFramesPerPacket = 64;
    asdb.mbitsPerChannel = 1;

    All the rest is to 0 (flags, byte per frame, bits per channel, reserved).

    Edit :

    I just find that the codec code 17 is maybe for kAudioFormatDVIIntelIMA and not kAudioFormatAppleIMA4. Can someone confirm this ?

    This is from ffprobe :

    [PACKET]
    codec_type=audio
    stream_index=1
    pts=11200
    pts_time=11.200000
    dts=11200
    dts_time=11.200000
    duration=164
    duration_time=0.164000
    size=656.000000
    pos=1171105
    flags=K
    [/PACKET]

    Is the size 656 for mBytesperpacket ?

    With this value and the half 328 for mFramesPerPacket i can hear something but it's not continuous and has a lot of noise.

    Please help !