Recherche avancée

Médias (91)

Autres articles (30)

  • L’espace de configuration de MediaSPIP

    29 novembre 2010, par

    L’espace de configuration de MediaSPIP est réservé aux administrateurs. Un lien de menu "administrer" est généralement affiché en haut de la page [1].
    Il permet de configurer finement votre site.
    La navigation de cet espace de configuration est divisé en trois parties : la configuration générale du site qui permet notamment de modifier : les informations principales concernant le site (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (3432)

  • Problem using FFmpeg to convert MKV with A/52 B audio (aka E-AC3) to AAC

    5 juillet 2020, par nxl4

    I've got a number of MKV files which are (per VLC) encoded with A/52 B (aka E-AC3) audio codecs. I would like to convert these to AAC, but I'm having trouble doing this with FFmpeg. The command I'm running is :

    



    ffmpeg -hwaccel auto -i original_file.mkv -y -c:v copy -c:a aac output_file.mkv


    



    The command completes without error. However, the generated file has no audio when I play it. FFmpeg's output is as follows :

    



    ffmpeg version 4.2.2-1ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-3ubuntu1)
  configuration: --prefix=/usr --extra-version=1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Guessed Channel Layout for Input Stream #0.1 : 5.1
Input #0, matroska,webm, from 'input_file.mkv':
  Metadata:
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2018-05-10T10:21:30.000000Z
  Duration: 00:42:08.15, start: 0.000000, bitrate: 3201 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      BPS-eng         : 2559028
      DURATION-eng    : 00:42:08.151000000
      NUMBER_OF_FRAMES-eng: 60615
      NUMBER_OF_BYTES-eng: 808701337
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: eac3, 48000 Hz, 5.1, fltp (default)
    Metadata:
      BPS-eng         : 640000
      DURATION-eng    : 00:42:08.096000000
      NUMBER_OF_FRAMES-eng: 79003
      NUMBER_OF_BYTES-eng: 202247680
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Subtitle: subrip
    Metadata:
      BPS-eng         : 79
      DURATION-eng    : 00:41:15.299000000
      NUMBER_OF_FRAMES-eng: 802
      NUMBER_OF_BYTES-eng: 24598
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(eng): Subtitle: subrip
    Metadata:
      title           : SDH
      BPS-eng         : 82
      DURATION-eng    : 00:41:15.299000000
      NUMBER_OF_FRAMES-eng: 844
      NUMBER_OF_BYTES-eng: 25598
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (eac3 (native) -> aac (native))
  Stream #0:2 -> #0:2 (subrip (srt) -> ass (ssa))
Press [q] to stop, [?] for help
[aac @ 0x55d0572a1740] Using a PCE to encode channel layout "5.1(side)"
Output #0, matroska, to 'output_file.mkv':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      BPS-eng         : 2559028
      DURATION-eng    : 00:42:08.151000000
      NUMBER_OF_FRAMES-eng: 60615
      NUMBER_OF_BYTES-eng: 808701337
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, 5.1(side), fltp, 394 kb/s (default)
    Metadata:
      BPS-eng         : 640000
      DURATION-eng    : 00:42:08.096000000
      NUMBER_OF_FRAMES-eng: 79003
      NUMBER_OF_BYTES-eng: 202247680
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc58.54.100 aac
    Stream #0:2(eng): Subtitle: ass (ssa)
    Metadata:
      BPS-eng         : 79
      DURATION-eng    : 00:41:15.299000000
      NUMBER_OF_FRAMES-eng: 802
      NUMBER_OF_BYTES-eng: 24598
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      encoder         : Lavc58.54.100 ssa 
video:789747kB audio:121419kB subtitle:41kB other streams:0kB global headers:1kB muxing overhead: 0.142563%
[aac @ 0x55d0572a1740] Qavg: 428.063


    



    Any ideas what I'm doing wrong here ? In case it helps an ffprobe -show_streams command run on the original file shows the following :

    



    DL.DDP5.1.H.264-NTG.mkv
ffprobe version 4.2.2-1ubuntu1 Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-3ubuntu1)
  configuration: --prefix=/usr --extra-version=1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, matroska,webm, from 'input_file.mkv':
  Metadata:
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2018-05-10T10:21:30.000000Z
  Duration: 00:42:08.15, start: 0.000000, bitrate: 3201 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      BPS-eng         : 2559028
      DURATION-eng    : 00:42:08.151000000
      NUMBER_OF_FRAMES-eng: 60615
      NUMBER_OF_BYTES-eng: 808701337
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: eac3, 48000 Hz, 6 channels, fltp (default)
    Metadata:
      BPS-eng         : 640000
      DURATION-eng    : 00:42:08.096000000
      NUMBER_OF_FRAMES-eng: 79003
      NUMBER_OF_BYTES-eng: 202247680
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Subtitle: subrip
    Metadata:
      BPS-eng         : 79
      DURATION-eng    : 00:41:15.299000000
      NUMBER_OF_FRAMES-eng: 802
      NUMBER_OF_BYTES-eng: 24598
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(eng): Subtitle: subrip
    Metadata:
      title           : SDH
      BPS-eng         : 82
      DURATION-eng    : 00:41:15.299000000
      NUMBER_OF_FRAMES-eng: 844
      NUMBER_OF_BYTES-eng: 25598
      _STATISTICS_WRITING_APP-eng: mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-10 10:21:30
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1001/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=1280
height=720
coded_width=1280
coded_height=720
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=31
color_range=tv
color_space=bt709
color_transfer=bt709
color_primaries=bt709
chroma_location=left
field_order=progressive
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:BPS-eng=2559028
TAG:DURATION-eng=00:42:08.151000000
TAG:NUMBER_OF_FRAMES-eng=60615
TAG:NUMBER_OF_BYTES-eng=808701337
TAG:_STATISTICS_WRITING_APP-eng=mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
TAG:_STATISTICS_WRITING_DATE_UTC-eng=2018-05-10 10:21:30
TAG:_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[/STREAM]
[STREAM]
index=1
codec_name=eac3
codec_long_name=ATSC A/52B (AC-3, E-AC-3)
profile=unknown
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=48000
channels=6
channel_layout=unknown
bits_per_sample=0
dmix_mode=-1
ltrt_cmixlev=-1.000000
ltrt_surmixlev=-1.000000
loro_cmixlev=-1.000000
loro_surmixlev=-1.000000
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:BPS-eng=640000
TAG:DURATION-eng=00:42:08.096000000
TAG:NUMBER_OF_FRAMES-eng=79003
TAG:NUMBER_OF_BYTES-eng=202247680
TAG:_STATISTICS_WRITING_APP-eng=mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
TAG:_STATISTICS_WRITING_DATE_UTC-eng=2018-05-10 10:21:30
TAG:_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[/STREAM]
[STREAM]
index=2
codec_name=subrip
codec_long_name=SubRip subtitle
profile=unknown
codec_type=subtitle
codec_time_base=0/1
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=N/A
height=N/A
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=2528151
duration=2528.151000
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:BPS-eng=79
TAG:DURATION-eng=00:41:15.299000000
TAG:NUMBER_OF_FRAMES-eng=802
TAG:NUMBER_OF_BYTES-eng=24598
TAG:_STATISTICS_WRITING_APP-eng=mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
TAG:_STATISTICS_WRITING_DATE_UTC-eng=2018-05-10 10:21:30
TAG:_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[/STREAM]
[STREAM]
index=3
codec_name=subrip
codec_long_name=SubRip subtitle
profile=unknown
codec_type=subtitle
codec_time_base=0/1
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=N/A
height=N/A
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=2528151
duration=2528.151000
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=eng
TAG:title=SDH
TAG:BPS-eng=82
TAG:DURATION-eng=00:41:15.299000000
TAG:NUMBER_OF_FRAMES-eng=844
TAG:NUMBER_OF_BYTES-eng=25598
TAG:_STATISTICS_WRITING_APP-eng=mkvmerge v21.0.0 ('Tardigrades Will Inherit The Earth') 64-bit
TAG:_STATISTICS_WRITING_DATE_UTC-eng=2018-05-10 10:21:30
TAG:_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[/STREAM]



    


  • MP4 Created Using FFmpeg API Can't Be Played in Media Players

    11 avril 2020, par RandyCroucher

    I've been struggling with this issue for days. There are similar issues posted here and around the web, but none of the solutions seem to work for me. They are possibly outdated ?

    



    Here is the current iteration of code I'm using to generate the MP4 file.

    



    It generates a simple 2 second .mp4 file that fails to play in any player I've tried. If I run that mp4 file back through the FFmpeg command line, it will generate a perfectly playable movie out of it. So the data is there.

    



    Also, if you modify the output file name in this code from .mp4 to .avi, this code generates a playable avi file too. So whatever it is, it is tied to the H.264 format.

    



    I'm sure I'm missing something simple, but for the life of me, I can't figure out what that is.

    



    Any help would be greatly appreciated !

    



    Here is a link to the VC++ project. MovieMaker.zip

    



    MovieMaker.h

    



    #pragma once&#xA;&#xA;extern "C"&#xA;{&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include <libavutil></libavutil>opt.h>&#xA;}&#xA;&#xA;class FMovieMaker&#xA;{&#xA;public:&#xA;    ~FMovieMaker();&#xA;&#xA;    bool Initialize(const char* FileName, int Width = 1920, int Height = 1080, int FPS = 30, int BitRate = 2000);&#xA;    bool RecordFrame(uint8_t* BGRAData);&#xA;    bool Finalize();&#xA;&#xA;    bool IsInitialized() const { return bInitialized; }&#xA;    int GetWidth() const { return CodecContext ? CodecContext->width : 0; }&#xA;    int GetHeight() const { return CodecContext ? CodecContext->height : 0; }&#xA;&#xA;private:&#xA;    bool EncodeFrame(bool bFinalize);&#xA;    void Log(const char* fmt, ...);&#xA;&#xA;    AVOutputFormat* OutputFormat = nullptr;&#xA;    AVFormatContext* FormatContext = nullptr;&#xA;    AVCodecContext* CodecContext = nullptr;&#xA;    AVFrame* Frame = nullptr;&#xA;    SwsContext* ColorConverter = nullptr;&#xA;    int64_t RecordedFrames = 0;&#xA;    bool bInitialized = false;&#xA;};&#xA;

    &#xA;&#xA;

    MovieMaker.cpp

    &#xA;&#xA;

    #include "MovieMaker.h"&#xA;&#xA;FMovieMaker::~FMovieMaker()&#xA;{&#xA;    if (IsInitialized())&#xA;        Finalize();&#xA;}&#xA;&#xA;bool FMovieMaker::Initialize(const char* FileName, int Width /*= 1920*/, int Height /*= 1080*/, int FPS /*= 30*/, int BitRate /*= 2000*/)&#xA;{&#xA;    OutputFormat = av_guess_format(nullptr, FileName, nullptr);&#xA;    if (!OutputFormat)&#xA;    {&#xA;        Log("Couldn&#x27;t guess the output format from the filename: %s", FileName);&#xA;        return false;&#xA;    }&#xA;&#xA;    AVCodecID CodecID = OutputFormat->video_codec;&#xA;    if (CodecID == AV_CODEC_ID_NONE)&#xA;    {&#xA;        Log("Could not determine a codec to use");&#xA;        return false;&#xA;    }&#xA;&#xA;    /* allocate the output media context */&#xA;    int ErrorCode = avformat_alloc_output_context2(&amp;FormatContext, OutputFormat, nullptr, FileName);&#xA;    if (ErrorCode &lt; 0)&#xA;    {&#xA;        char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;        av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;        Log("Failed to allocate format context: %s", Error);&#xA;        return false;&#xA;    }&#xA;    else if (!FormatContext)&#xA;    {&#xA;        Log("Failed to get format from filename: %s", FileName);&#xA;        return false;&#xA;    }&#xA;&#xA;    /* find the video encoder */&#xA;    const AVCodec* Codec = avcodec_find_encoder(CodecID);&#xA;    if (!Codec)&#xA;    {&#xA;        Log("Codec &#x27;%d&#x27; not found", CodecID);&#xA;        return false;&#xA;    }&#xA;&#xA;    /* create the video stream */&#xA;    AVStream* Stream = avformat_new_stream(FormatContext, Codec);&#xA;    if (!Stream)&#xA;    {&#xA;        Log("Failed to allocate stream");&#xA;        return false;&#xA;    }&#xA;&#xA;    /* create the codec context */&#xA;    CodecContext = avcodec_alloc_context3(Codec);&#xA;    if (!CodecContext)&#xA;    {&#xA;        Log("Could not allocate video codec context");&#xA;        return false;&#xA;    }&#xA;&#xA;    Stream->codecpar->codec_id = OutputFormat->video_codec;&#xA;    Stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    Stream->codecpar->width = Width;&#xA;    Stream->codecpar->height = Height;&#xA;    Stream->codecpar->format = AV_PIX_FMT_YUV420P;&#xA;    Stream->codecpar->bit_rate = (int64_t)BitRate * 1000;&#xA;    avcodec_parameters_to_context(CodecContext, Stream->codecpar);&#xA;&#xA;    CodecContext->time_base = { 1, FPS };&#xA;    CodecContext->max_b_frames = 2;&#xA;    CodecContext->gop_size = 12;&#xA;    CodecContext->framerate = { FPS, 1 };&#xA;&#xA;    if (Stream->codecpar->codec_id == AV_CODEC_ID_H264)&#xA;        av_opt_set(CodecContext, "preset", "medium", 0);&#xA;    else if (Stream->codecpar->codec_id == AV_CODEC_ID_H265)&#xA;        av_opt_set(CodecContext, "preset", "medium", 0);&#xA;&#xA;    avcodec_parameters_from_context(Stream->codecpar, CodecContext);&#xA;&#xA;    if (FormatContext->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;        CodecContext->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;&#xA;    if ((ErrorCode = avcodec_open2(CodecContext, Codec, NULL)) &lt; 0)&#xA;    {&#xA;        char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;        av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;        Log("Failed to open codec: %s", Error);&#xA;        return false;&#xA;    }&#xA;&#xA;    if (!(OutputFormat->flags &amp; AVFMT_NOFILE))&#xA;    {&#xA;        if ((ErrorCode = avio_open(&amp;FormatContext->pb, FileName, AVIO_FLAG_WRITE)) &lt; 0)&#xA;        {&#xA;            char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;            av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;            Log("Failed to open file: %s", Error);&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;    Stream->time_base = CodecContext->time_base;&#xA;    if ((ErrorCode = avformat_write_header(FormatContext, NULL)) &lt; 0)&#xA;    {&#xA;        char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;        av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;        Log("Failed to write header: %s", Error);&#xA;        return false;&#xA;    }&#xA;&#xA;    CodecContext->time_base = Stream->time_base;&#xA;&#xA;    av_dump_format(FormatContext, 0, FileName, 1);&#xA;&#xA;    // create the frame&#xA;    {&#xA;        Frame = av_frame_alloc();&#xA;        if (!Frame)&#xA;        {&#xA;            Log("Could not allocate video frame");&#xA;            return false;&#xA;        }&#xA;        Frame->format = CodecContext->pix_fmt;&#xA;        Frame->width = CodecContext->width;&#xA;        Frame->height = CodecContext->height;&#xA;&#xA;        ErrorCode = av_frame_get_buffer(Frame, 32);&#xA;        if (ErrorCode &lt; 0)&#xA;        {&#xA;            char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;            av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;            Log("Could not allocate the video frame data: %s", Error);&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;    // create a color converter&#xA;    {&#xA;        ColorConverter = sws_getContext(CodecContext->width, CodecContext->height, AV_PIX_FMT_BGRA,&#xA;                                        CodecContext->width, CodecContext->height, AV_PIX_FMT_YUV420P, 0, 0, 0, 0);&#xA;        if (!ColorConverter)&#xA;        {&#xA;            Log("Could not allocate color converter");&#xA;            return false;&#xA;        }&#xA;    }&#xA;&#xA;    bInitialized = true;&#xA;    return true;&#xA;}&#xA;&#xA;bool FMovieMaker::RecordFrame(uint8_t* BGRAData)&#xA;{&#xA;    if (!bInitialized)&#xA;    {&#xA;        Log("Cannot record frames on an uninitialized Video Recorder");&#xA;        return false;&#xA;    }&#xA;&#xA;    /*make sure the frame data is writable */&#xA;    int ErrorCode = av_frame_make_writable(Frame);&#xA;    if (ErrorCode &lt; 0)&#xA;    {&#xA;        char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;        av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;        Log("Could not make the frame writable: %s", Error);&#xA;        return false;&#xA;    }&#xA;&#xA;    /* convert the bgra bitmap data into yuv frame data */&#xA;    int inLinesize[1] = { 4 * CodecContext->width }; // RGB stride&#xA;    sws_scale(ColorConverter, &amp;BGRAData, inLinesize, 0, CodecContext->height, Frame->data, Frame->linesize);&#xA;&#xA;    //Frame->pts = RecordedFrames&#x2B;&#x2B;;&#xA;    Frame->pts = CodecContext->time_base.den / CodecContext->time_base.num * CodecContext->framerate.den / CodecContext->framerate.num * (RecordedFrames&#x2B;&#x2B;);&#xA;    //The following assumes that codecContext->time_base = (AVRational){1, 1};&#xA;    //Frame->pts = frameduration * (RecordedFrames&#x2B;&#x2B;) * Stream->time_base.den / (Stream->time_base.num * fps);&#xA;    //Frame->pts &#x2B;= av_rescale_q(1, CodecContext->time_base, Stream->time_base);&#xA;&#xA;    return EncodeFrame(false);&#xA;}&#xA;&#xA;bool FMovieMaker::EncodeFrame(bool bFinalize)&#xA;{&#xA;    /* send the frame to the encoder */&#xA;    int ErrorCode = avcodec_send_frame(CodecContext, bFinalize ? nullptr : Frame);&#xA;    if (ErrorCode &lt; 0)&#xA;    {&#xA;        char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;        av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;        Log("Error sending a frame for encoding: %s", Error);&#xA;        return false;&#xA;    }&#xA;&#xA;    AVPacket Packet;&#xA;    av_init_packet(&amp;Packet);&#xA;    Packet.data = NULL;&#xA;    Packet.size = 0;&#xA;    Packet.flags |= AV_PKT_FLAG_KEY;&#xA;    Packet.pts = Frame->pts;&#xA;&#xA;    if (avcodec_receive_packet(CodecContext, &amp;Packet) == 0)&#xA;    {&#xA;        //std::cout &lt;&lt; "pkt key: " &lt;&lt; (Packet.flags &amp; AV_PKT_FLAG_KEY) &lt;&lt; " " &lt;&lt; Packet.size &lt;&lt; " " &lt;&lt; (counter&#x2B;&#x2B;) &lt;&lt; std::endl;&#xA;        uint8_t* size = ((uint8_t*)Packet.data);&#xA;        //std::cout &lt;&lt; "first: " &lt;&lt; (int)size[0] &lt;&lt; " " &lt;&lt; (int)size[1] &lt;&lt; " " &lt;&lt; (int)size[2] &lt;&lt; " " &lt;&lt; (int)size[3] &lt;&lt; " " &lt;&lt; (int)size[4] &lt;&lt; " " &lt;&lt; (int)size[5] &lt;&lt; " " &lt;&lt; (int)size[6] &lt;&lt; " " &lt;&lt; (int)size[7] &lt;&lt; std::endl;&#xA;&#xA;        av_interleaved_write_frame(FormatContext, &amp;Packet);&#xA;        av_packet_unref(&amp;Packet);&#xA;    }&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;bool FMovieMaker::Finalize()&#xA;{&#xA;    if (!bInitialized)&#xA;    {&#xA;        Log("Cannot finalize uninitialized Video Recorder");&#xA;        return false;&#xA;    }&#xA;&#xA;    //DELAYED FRAMES&#xA;    AVPacket Packet;&#xA;    av_init_packet(&amp;Packet);&#xA;    Packet.data = NULL;&#xA;    Packet.size = 0;&#xA;&#xA;    for (;;)&#xA;    {&#xA;        avcodec_send_frame(CodecContext, NULL);&#xA;        if (avcodec_receive_packet(CodecContext, &amp;Packet) == 0)&#xA;        {&#xA;            av_interleaved_write_frame(FormatContext, &amp;Packet);&#xA;            av_packet_unref(&amp;Packet);&#xA;        }&#xA;        else&#xA;            break;&#xA;    }&#xA;&#xA;    av_write_trailer(FormatContext);&#xA;    if (!(OutputFormat->flags &amp; AVFMT_NOFILE))&#xA;    {&#xA;        int ErrorCode = avio_close(FormatContext->pb);&#xA;        if (ErrorCode &lt; 0)&#xA;        {&#xA;            char Error[AV_ERROR_MAX_STRING_SIZE];&#xA;            av_make_error_string(Error, AV_ERROR_MAX_STRING_SIZE, ErrorCode);&#xA;            Log("Failed to close file: %s", Error);&#xA;        }&#xA;    }&#xA;&#xA;    if (Frame)&#xA;    {&#xA;        av_frame_free(&amp;Frame);&#xA;        Frame = nullptr;&#xA;    }&#xA;&#xA;    if (CodecContext)&#xA;    {&#xA;        avcodec_free_context(&amp;CodecContext);&#xA;        CodecContext = nullptr;&#xA;    }&#xA;&#xA;    if (FormatContext)&#xA;    {&#xA;        avformat_free_context(FormatContext);&#xA;        FormatContext = nullptr;&#xA;    }&#xA;&#xA;    if (ColorConverter)&#xA;    {&#xA;        sws_freeContext(ColorConverter);&#xA;        ColorConverter = nullptr;&#xA;    }&#xA;&#xA;    bInitialized = false;&#xA;    return true;&#xA;}&#xA;&#xA;void FMovieMaker::Log(const char* fmt, ...)&#xA;{&#xA;    va_list args;&#xA;    fprintf(stderr, "LOG: ");&#xA;    va_start(args, fmt);&#xA;    vfprintf(stderr, fmt, args);&#xA;    va_end(args);&#xA;    fprintf(stderr, "\n");&#xA;}&#xA;

    &#xA;&#xA;

    Main.cpp

    &#xA;&#xA;

    #include "MovieMaker.h"&#xA;&#xA;uint8_t FtoB(float x)&#xA;{&#xA;    if (x &lt;= 0.0f)&#xA;        return 0;&#xA;    if (x >= 1.0f)&#xA;        return 255;&#xA;    else&#xA;        return (uint8_t)(x * 255.0f);&#xA;}&#xA;&#xA;void SetPixelColor(float X, float Y, float Width, float Height, float t, uint8_t* BGRA)&#xA;{&#xA;    t &#x2B;= 12.0f; // more interesting colors at this time&#xA;&#xA;    float P[2] = { 0.1f * X - 25.0f, 0.1f * Y - 25.0f };&#xA;    float V = sqrtf(P[0] * P[0] &#x2B; P[1] * P[1]);&#xA;    BGRA[0] = FtoB(sinf(V &#x2B; t / 0.78f));&#xA;    BGRA[1] = FtoB(sinf(V &#x2B; t / 10.0f));&#xA;    BGRA[2] = FtoB(sinf(V &#x2B; t / 36e2f));&#xA;    BGRA[3] = 255;&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;    FMovieMaker MovieMaker;&#xA;&#xA;    const char* FileName = "C:\\ffmpeg\\MyMovieMakerMovie.mp4";&#xA;    int Width = 640;&#xA;    int Height = 480;&#xA;    int FPS = 30;&#xA;    int BitRateKBS = 2000;&#xA;&#xA;    if (MovieMaker.Initialize(FileName, Width, Height, FPS, BitRateKBS))&#xA;    {&#xA;        int Size = Width * 4 * Height;&#xA;        uint8_t* BGRAData = new uint8_t[Size];&#xA;        memset(BGRAData, 255, Size);&#xA;&#xA;        for (float Frame = 0; Frame &lt; 60; Frame&#x2B;&#x2B;)&#xA;        {&#xA;            // fill the image data with something interesting&#xA;            for (float Y = 0; Y &lt; Height; Y&#x2B;&#x2B;)&#xA;            {&#xA;                for (float X = 0; X &lt; Width; X&#x2B;&#x2B;)&#xA;                {&#xA;                    SetPixelColor(X, Y, (float)Width, (float)Height, Frame / (float)FPS, &amp;BGRAData[(int)(Y * Width &#x2B; X) * 4]);&#xA;                }&#xA;            }&#xA;&#xA;            if (!MovieMaker.RecordFrame(BGRAData))&#xA;                break;&#xA;        }&#xA;&#xA;        delete[] BGRAData;&#xA;&#xA;        MovieMaker.Finalize();&#xA;    }&#xA;}&#xA;

    &#xA;&#xA;

    If I have the lines that add the AV_CODEC_FLAG_GLOBAL_HEADER flag like shown above, I get all sorts of issues in the output from ffprobe MyMovieMakerMovie.mp4.

    &#xA;&#xA;

    C:\ffmpeg>ffprobe MyMovieMakerMovie.mp4&#xA;ffprobe version 4.2.2 Copyright (c) 2007-2019 the FFmpeg developers&#xA;  built with gcc 9.2.1 (GCC) 20200122&#xA;  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;[h264 @ 000001d44b795b00] non-existing PPS 0 referenced&#xA;[h264 @ 000001d44b795b00] decode_slice_header error&#xA;[h264 @ 000001d44b795b00] no frame!&#xA;...&#xA;[h264 @ 000001d44b795b00] non-existing PPS 0 referenced&#xA;[h264 @ 000001d44b795b00] decode_slice_header error&#xA;[h264 @ 000001d44b795b00] no frame!&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d44b783880] decoding for stream 0 failed&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 000001d44b783880] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 640x480, 20528 kb/s): unspecified pixel format&#xA;Consider increasing the value for the &#x27;analyzeduration&#x27; and &#x27;probesize&#x27; options&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;MyMovieMakerMovie.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf58.29.100&#xA;  Duration: 00:00:01.97, start: 0.000000, bitrate: 20529 kb/s&#xA;    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 640x480, 20528 kb/s, 30.51 fps, 30 tbr, 15360 tbn, 30720 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : VideoHandler&#xA;

    &#xA;&#xA;

    Without adding the AV_CODEC_FLAG_GLOBAL_HEADER flag, I get a clean output from ffprobe, but the video still doesn't play. Notice it thinks the frame rate is 30.51, I'm not sure why.

    &#xA;&#xA;

    C:\ffmpeg>ffprobe MyMovieMakerMovie.mp4&#xA;ffprobe version 4.2.2 Copyright (c) 2007-2019 the FFmpeg developers&#xA;  built with gcc 9.2.1 (GCC) 20200122&#xA;  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;MyMovieMakerMovie.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf58.29.100&#xA;  Duration: 00:00:01.97, start: 0.000000, bitrate: 20530 kb/s&#xA;    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480, 20528 kb/s, 30.51 fps, 30 tbr, 15360 tbn, 60 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : VideoHandler&#xA;

    &#xA;

  • ffmpeg determine correct codec to use

    8 avril 2020, par nha

    I am trying to use .y4m files that I feed into Chrome for playing.&#xA;This is the only format that I can use.

    &#xA;&#xA;

    I have a set of .y4m files that are working for my use case, taken from here.&#xA;For example let's say that I use the file mobile_qcif_7.5fps.y4m.

    &#xA;&#xA;

    I also have a .mp4 file (specifically the sample small.mp4 file from techslides ). I know how to convert small.mp4 to small.y4m with the following command :

    &#xA;&#xA;

    ffmpeg -y -i small.mp4 small.y4m

    &#xA;&#xA;

    I would like the resulting file to be accepted by Chrome, just like the other file.&#xA;What options should I use (and how to find them) ?

    &#xA;&#xA;

    Additional information

    &#xA;&#xA;

    ffprobe gives :

    &#xA;&#xA;

    $ ffprobe small.y4m &#xA;avprobe version 0.8.13-6:0.8.13-0ubuntu0.13.10.1, Copyright (c) 2007-2014 the Libav developers&#xA;  built on Jul 15 2014 13:48:35 with gcc 4.8.1&#xA;[yuv4mpegpipe @ 0x23160c0] Estimating duration from bitrate, this may be inaccurate&#xA;Input #0, yuv4mpegpipe, from &#x27;small.y4m&#x27;:&#xA;  Duration: N/A, bitrate: N/A&#xA;    Stream #0.0: Video: rawvideo, yuv420p, 560x320, 30 fps, 30 tbr, 30 tbn, 30 tbc&#xA;&#xA;&#xA;$ ffprobe mobile_qcif_7.5fps.y4m&#xA;avprobe version 0.8.13-6:0.8.13-0ubuntu0.13.10.1, Copyright (c) 2007-2014 the Libav developers&#xA;  built on Jul 15 2014 13:48:35 with gcc 4.8.1&#xA;[yuv4mpegpipe @ 0x1e080c0] max_analyze_duration reached&#xA;[yuv4mpegpipe @ 0x1e080c0] Estimating duration from bitrate, this may be inaccurate&#xA;Input #0, yuv4mpegpipe, from &#x27;mobile_qcif_7.5fps.y4m&#x27;:&#xA;  Duration: N/A, bitrate: N/A&#xA;    Stream #0.0: Video: rawvideo, yuv420p, 176x144, PAR 128:117 DAR 1408:1053, 7.50 fps, 7.50 tbr, 7.50 tbn, 7.50 tbc&#xA;

    &#xA;&#xA;

    OS : I am using ffmpeg in Ubuntu 13.10 from the default repository : I ran sudo apt-get install ffmpeg libavcodec-extra-53

    &#xA;&#xA;

    Complete console output

    &#xA;&#xA;

    $ ffmpeg -y -i small.mp4 small.y4m&#xA;ffmpeg version 0.8.13-6:0.8.13-0ubuntu0.13.10.1, Copyright (c) 2000-2014 the Libav developers&#xA;  built on Jul 15 2014 13:48:35 with gcc 4.8.1&#xA;*** THIS PROGRAM IS DEPRECATED ***&#xA;This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;small.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 0&#xA;    compatible_brands: mp42isomavc1&#xA;    creation_time   : 2010-03-20 21:29:11&#xA;    encoder         : HandBrake 0.9.4 2009112300&#xA;  Duration: 00:00:05.56, start: 0.000000, bitrate: 551 kb/s&#xA;    Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 560x320, 465 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc&#xA;    Metadata:&#xA;      creation_time   : 2010-03-20 21:29:11&#xA;    Stream #0.1(eng): Audio: aac, 48000 Hz, mono, s16, 83 kb/s&#xA;    Metadata:&#xA;      creation_time   : 2010-03-20 21:29:11&#xA;[buffer @ 0x7274e0] w:560 h:320 pixfmt:yuv420p&#xA;Output #0, yuv4mpegpipe, to &#x27;small.y4m&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 0&#xA;    compatible_brands: mp42isomavc1&#xA;    creation_time   : 2010-03-20 21:29:11&#xA;    encoder         : Lavf53.21.1&#xA;    Stream #0.0(und): Video: rawvideo, yuv420p, 560x320, q=2-31, 200 kb/s, 90k tbn, 30 tbc&#xA;    Metadata:&#xA;      creation_time   : 2010-03-20 21:29:11&#xA;Stream mapping:&#xA;  Stream #0.0 -> #0.0&#xA;Press ctrl-c to stop encoding&#xA;frame=  166 fps=  0 q=0.0 Lsize=   43576kB time=5.53 bitrate=64513.5kbits/s    &#xA;video:0kB audio:0kB global headers:0kB muxing overhead inf%&#xA;

    &#xA;&#xA;

    Head of the files

    &#xA;&#xA;

    Not sure if this is relevant, but the text content of both files begin like that :

    &#xA;&#xA;

    mobile_qcif_7.5fps.y4m&#xA;YUV4MPEG2 W176 H144 F15:2 Ip A128:117&#xA;FRAME&#xA;&#xA;small.y4m (invalid)&#xA;YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420mpeg2 XYSCSS=420MPEG2&#xA;FRAME&#xA;

    &#xA;&#xA;

    Additional experiment

    &#xA;&#xA;

    Taking the sample mobile_qcif_7.5fps.y4m, turning it into a .mp4 file and then back into a .y4m produces an invalid file (at least for Chrome).

    &#xA;&#xA;

    Answer to comments in the answer of @SirDarius

    &#xA;&#xA;

    Following the suggestion of @SirDarius ; I tried the following commands.&#xA;They failed to produce a valid file.

    &#xA;&#xA;

    # [COMMAND]   # [RESULT] [HEADER]&#xA;ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe -pix_fmt yuv444p -y small_yuv444p.y4m   # KO YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C444 XYSCSS=444&#xA;ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe -pix_fmt yuv422p -y small_yuv422p.y4m   # KO YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C422 XYSCSS=422&#xA;ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe -pix_fmt yuv420p -y small_yuv420p.y4m   # KO YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420mpeg2 XYSCSS=420MPEG2&#xA;ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe -pix_fmt yuv411p -y small_yuv411p.y4m   #&#xA0;KO   YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C411 XYSCSS=411&#xA;&#xA;ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe -strict -1 -pix_fmt yuv420p9 -y small_yuv420p9.y4m   # KO YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420p9 XYSCSS=420P9&#xA;ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe -strict -1 -pix_fmt yuv420p12 -y small_yuv420p12.y4m # KO YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420p12 XYSCSS=420P12&#xA;ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe -strict -1 -pix_fmt yuv420p14 -y small_yuv420p14.y4m #&#xA0;KO YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420p14 XYSCSS=420P14&#xA;ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe -strict -1 -pix_fmt yuv420p16 -y small_yuv420p16.y4m # KO YUV4MPEG2 W560 H320 F15:2 Ip A0:0 C420p16 XYSCSS=420P16&#xA;

    &#xA;&#xA;

    When trying other formats (like yuv420p12be, which was in the output of -pix_fmts), I had the following output (hence my previous trials) :

    &#xA;&#xA;

    $  ffmpeg -i small.mp4 -vf fps=7.5 -an -c:v rawvideo -f yuv4mpegpipe -pix_fmt yuv420p12be -y small_yuv420p12be.y4m &#xA;ffmpeg version N-68884-g3ebd76a Copyright (c) 2000-2015 the FFmpeg developers&#xA;  built on Jan  6 2015 11:03:21 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)&#xA;  configuration: &#xA;  libavutil      54. 16.100 / 54. 16.100&#xA;  libavcodec     56. 19.100 / 56. 19.100&#xA;  libavformat    56. 18.100 / 56. 18.100&#xA;  libavdevice    56.  3.100 / 56.  3.100&#xA;  libavfilter     5.  6.100 /  5.  6.100&#xA;  libswscale      3.  1.101 /  3.  1.101&#xA;  libswresample   1.  1.100 /  1.  1.100&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x21d0220] overread end of atom &#x27;colr&#x27; by 1 bytes&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;small.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 0&#xA;    compatible_brands: mp42isomavc1&#xA;    creation_time   : 2010-03-20 21:29:11&#xA;    encoder         : HandBrake 0.9.4 2009112300&#xA;  Duration: 00:00:05.57, start: 0.000000, bitrate: 551 kb/s&#xA;    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 560x320, 465 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)&#xA;    Metadata:&#xA;      creation_time   : 2010-03-20 21:29:11&#xA;      encoder         : JVT/AVC Coding&#xA;    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 83 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2010-03-20 21:29:11&#xA;[yuv4mpegpipe @ 0x21d8180] ERROR: yuv4mpeg can only handle yuv444p, yuv422p, yuv420p, yuv411p and gray8 pixel formats. And using &#x27;strict -1&#x27; also yuv444p9, yuv422p9, yuv420p9, yuv444p10, yuv422p10, yuv420p10, yuv444p12, yuv422p12, yuv420p12, yuv444p14, yuv422p14, yuv420p14, yuv444p16, yuv422p16, yuv420p16 and gray16 pixel formats. Use -pix_fmt to select one.&#xA;Output #0, yuv4mpegpipe, to &#x27;small_yuv420p12be.y4m&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 0&#xA;    compatible_brands: mp42isomavc1&#xA;    encoder         : Lavf56.18.100&#xA;    Stream #0:0(und): Video: rawvideo ([12][11]3Y / 0x59330B0C), yuv420p12be, 560x320, q=2-31, 200 kb/s, 7.50 fps, 7.50 tbn, 7.50 tbc (default)&#xA;    Metadata:&#xA;      creation_time   : 2010-03-20 21:29:11&#xA;      encoder         : Lavc56.19.100 rawvideo&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))&#xA;Could not write header for output file #0 (incorrect codec parameters ?): Input/output error&#xA;

    &#xA;&#xA;

    After that, I also tried to edit with an hexadecimal editor (bless) the small_yuv420p.y4m file. I replace C420mpeg2 by C420, and the file was accepted by Chrome.&#xA;What does the number in 420p[number] correspond to ? It is not explained there.&#xA;Is there any way to make ffmpeg output this kind of header files ?

    &#xA;&#xA;

    @SirDarius, thank you again for your help.

    &#xA;&#xA;

    The question

    &#xA;&#xA;

    (in case you forgot after this text blob)

    &#xA;&#xA;

    How can I convert the small.mp4 into a small.y4m file that has the same properties as the mobile_qcif_7.5fps.y4m file ?

    &#xA;