Recherche avancée

Médias (0)

Mot : - Tags -/auteurs

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

Autres articles (7)

  • 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 (...)

  • Déploiements possibles

    31 janvier 2010, par

    Deux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
    L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
    Version mono serveur
    La version mono serveur consiste à n’utiliser qu’une (...)

  • 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 (5680)

  • ffmpeg issue when using it from kurento to rtmp stream

    15 juillet 2020, par Maxi

    I successfully managed to connect ffmpeg with an RTP endpoint of my kurento server. On many tries before I got a "Connection timed out" due my docker configuration. In my docker logs I see following now after RTP endpoint creation and starting ffmpeg :

    


    streamy-server_1  | 2020-07-15 08:30:20.397  INFO 49 --- [nio-8080-exec-1] net.bramp.ffmpeg.RunProcessFunction      : ffmpeg -y -v error -protocol_whitelist file,http,https,tcp,tls,udp,rtp -rtbufsize 1500M -re -i /tmp/test.sdp -f flv -vcodec libx264 -pix_fmt yuv420p -s 640x480 -r 20/1 -b:v 1000000 -acodec libmp3lame -ar 44100 -b:a 1000000 -bufsize 4000k -maxrate 1000k -profile:v baseline -deinterlace -preset medium -g 60 -r 30 rtmps://live-api-s.facebook.com:443/rtmp/3163232097002611?xyz
streamy-server_1  | [h264 @ 0x56538aeae0a0] non-existing PPS 0 referenced
streamy-server_1  |     Last message repeated 1 times
streamy-server_1  | [h264 @ 0x56538aeae0a0] decode_slice_header error
streamy-server_1  | [h264 @ 0x56538aeae0a0] no frame!
streamy-server_1  | [h264 @ 0x56538aeae0a0] non-existing PPS 0 referenced
streamy-server_1  |     Last message repeated 1 times
streamy-server_1  | [h264 @ 0x56538aeae0a0] decode_slice_header error
streamy-server_1  | [h264 @ 0x56538aeae0a0] no frame!
streamy-server_1  | [h264 @ 0x56538aeae0a0] non-existing PPS 0 referenced
streamy-server_1  |     Last message repeated 1 times
streamy-server_1  | [h264 @ 0x56538aeae0a0] decode_slice_header error
streamy-server_1  | [h264 @ 0x56538aeae0a0] no frame!
streamy-server_1  | [h264 @ 0x56538aeae0a0] non-existing PPS 0 referenced
streamy-server_1  |     Last message repeated 1 times
streamy-server_1  | [h264 @ 0x56538aeae0a0] decode_slice_header error
streamy-server_1  | [h264 @ 0x56538aeae0a0] no frame!
streamy-server_1  | [h264 @ 0x56538aeae0a0] non-existing PPS 0 referenced
streamy-server_1  |     Last message repeated 1 times
[...] (this is repeated for the next ~20-30 seconds, then continues with:)
kurento_1         | 0:03:00.152967182     1 0x7faa58093b30 INFO    KurentoWebSocketTransport WebSocketTransport.cpp:296:keepAliveSessions: Keep alive 998a9271-615e-490c-acce-6bc22d9592f7
streamy-server_1  | Too many packets buffered for output stream 0:0.
streamy-server_1  | 2020-07-15 08:30:38.361 ERROR 49 --- [nio-8080-exec-1] c.maximummgt.streamy.WebsocketsHandler   : Unknown error while websockets session
streamy-server_1  | 
streamy-server_1  | java.lang.RuntimeException: java.io.IOException: ffmpeg returned non-zero exit status. Check stdout.
streamy-server_1  |     at net.bramp.ffmpeg.job.SinglePassFFmpegJob.run(SinglePassFFmpegJob.java:46) ~[ffmpeg-0.6.2.jar:0.6.2]


    


    At facebook live it does not receive the video stream. In log I just see this message :

    


    Facebook has not received video signal from the video source for some time. Check that the connectivity between the video source and Facebook is sufficient for the source resolution and bitrate. Check your video encoder logs for details. If problems persist, consider improving connection quality or reducing the bitrate of your video source.

    


    On Kurento Java code I am doing following :

    


      

    1. Create an RTP endpoint

      


    2. 


    3. Connect it with the video source from the user

      


    4. 


    5. Create an SDP offer and save it to a file (currently /tmp/test.sdp)

      


    6. 


    7. Process SDP offer with the RTP endpoint

      


    8. 


    9. Start the ffmpeg process with (net.bramp.ffmpeg.builder.FFmpegBuilder) :

      


      FFmpegBuilder builder = new FFmpegBuilder()
.addExtraArgs("-protocol_whitelist", "file,http,https,tcp,tls,udp,rtp")
.addExtraArgs("-rtbufsize", "1500M")
.addExtraArgs("-re")
.setInput("/tmp/test.sdp")
.addOutput(rtmpURL)
.setFormat("flv")
.addExtraArgs("-bufsize", "4000k")
.addExtraArgs("-maxrate", "1000k")
.setAudioCodec("libmp3lame")
.setAudioSampleRate(FFmpeg.AUDIO_SAMPLE_44100)
.setAudioBitRate(1_000_000)
.addExtraArgs("-profile:v", "baseline")
.setVideoCodec("libx264")
.setVideoPixelFormat("yuv420p")
.setVideoResolution(width, height)
.setVideoBitRate(1_000_000)
.setVideoFrameRate(20)
.addExtraArgs("-deinterlace")
.addExtraArgs("-preset", "medium")
.addExtraArgs("-g", "60")
.addExtraArgs("-r", "30")
.done();

FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);
executor.createJob(builder).run();



      


    10. 


    


    Can somebody guide here on this issue ? Thanks in advance

    


    EDIT 01 : I disabled now

    


    // FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);
// executor.createJob(builder).run();


    


    so that ffmpeg does not start automatically. After java created the test.sdp, I ran ffmpeg by myself in the console not to stream to facebook but to a mp4 :

    


    ffmpeg -loglevel debug -protocol_whitelist file,crypto,udp,rtp -re -vcodec libvpx -acodec opus -i /tmp/test.sdp -vcodec libx264 -acodec aac -y output.mp4

    


    The output looks as following - I interrupted it after 25s with CTRL + C

    


    root@app:/var/www# ffmpeg -loglevel debug -protocol_whitelist file,crypto,udp,rtp -re -vcodec libvpx -acodec opus -i /tmp/test.sdp -vcodec libx264 -acodec aac -y output.mp4
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-protocol_whitelist' ... matched as AVOption 'protocol_whitelist' with argument 'file,crypto,udp,rtp'.
Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'libvpx'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'opus'.
Reading option '-i' ... matched as input url with argument '/tmp/test.sdp'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'libx264'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option 'output.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url /tmp/test.sdp.
Applying option re (read input at native frame rate) with argument 1.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument libvpx.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument opus.
Successfully parsed a group of options.
Opening an input file: /tmp/test.sdp.
[NULL @ 0x55c2344e6a00] Opening '/tmp/test.sdp' for reading
[sdp @ 0x55c2344e6a00] Format sdp probed with size=2048 and score=50
[sdp @ 0x55c2344e6a00] audio codec set to: pcm_mulaw
[sdp @ 0x55c2344e6a00] audio samplerate set to: 44000
[sdp @ 0x55c2344e6a00] audio channels set to: 1
[sdp @ 0x55c2344e6a00] video codec set to: h264
[sdp @ 0x55c2344e6a00] RTP Packetization Mode: 1
[udp @ 0x55c2344e90c0] end receive buffer size reported is 131072
[udp @ 0x55c2344e9320] end receive buffer size reported is 131072
[sdp @ 0x55c2344e6a00] setting jitter buffer size to 500
[udp @ 0x55c2344ea0a0] end receive buffer size reported is 131072
[udp @ 0x55c2344ea180] end receive buffer size reported is 131072
[sdp @ 0x55c2344e6a00] setting jitter buffer size to 500
[sdp @ 0x55c2344e6a00] Before avformat_find_stream_info() pos: 305 bytes read:305 seeks:0 nb_streams:2
[libvpx @ 0x55c2344eeb80] v1.7.0
[libvpx @ 0x55c2344eeb80] --prefix=/usr --enable-pic --enable-shared --disable-install-bins --disable-install-srcs --size-limit=16384x16384 --enable-postproc --enable-multi-res-encoding --enable-temporal-denoising --enable-vp9-temporal-denoising --enable-vp9-postproc --target=x86_64-linux-gcc
[libvpx @ 0x55c2344eeb80] Invalid sync code e06101.
[libvpx @ 0x55c2344eeb80] Failed to decode frame: Bitstream not supported by this decoder
[libvpx @ 0x55c2344eeb80] Invalid sync code e06101.
[libvpx @ 0x55c2344eeb80] Failed to decode frame: Bitstream not supported by this decoder
    Last message repeated 1 times
[libvpx @ 0x55c2344eeb80] Invalid sync code e06101.
[libvpx @ 0x55c2344eeb80] Failed to decode frame: Bitstream not supported by this decoder
[sdp @ 0x55c2344e6a00] Non-increasing DTS in stream 1: packet 3 with DTS 5940, packet 4 with DTS 5940
[...]
[sdp @ 0x55c2344e6a00] Non-increasing DTS in stream 1: packet 956 with DTS 2027726, packet 957 with DTS 2027726
[libvpx @ 0x55c2344eeb80] Failed to decode frame: Bitstream not supported by this decoder
[libvpx @ 0x55c2344eeb80] Invalid sync code e06101.
[libvpx @ 0x55c2344eeb80] Failed to decode frame: Bitstream not supported by this decoder
[libvpx @ 0x55c2344eeb80] Invalid sync code e06101.
[libvpx @ 0x55c2344eeb80] Failed to decode frame: Bitstream not supported by this decoder
[libvpx @ 0x55c2344eeb80] Invalid sync code e06101.
[libvpx @ 0x55c2344eeb80] Failed to decode frame: Bitstream not supported by this decoder
[libvpx @ 0x55c2344eeb80] Invalid sync code 4a3bd8.
[sdp @ 0x55c2344e6a00] Non-increasing DTS in stream 1: packet 960 with DTS 2036690, packet 961 with DTS 2036690
[libvpx @ 0x55c2344eeb80] Failed to decode frame: Bitstream not supported by this decoder
[sdp @ 0x55c2344e6a00] interrupted
[sdp @ 0x55c2344e6a00] decoding for stream 1 failed
[sdp @ 0x55c2344e6a00] rfps: 30.000000 0.000926
[sdp @ 0x55c2344e6a00] rfps: 60.000000 0.003706
[sdp @ 0x55c2344e6a00] rfps: 120.000000 0.014824
[sdp @ 0x55c2344e6a00] Setting avg frame rate based on r frame rate
[sdp @ 0x55c2344e6a00] Could not find codec parameters for stream 1 (Video: vp8 (libvpx), 1 reference frame, none(progressive)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[sdp @ 0x55c2344e6a00] After avformat_find_stream_info() pos: 305 bytes read:305 seeks:0 frames:962
Input #0, sdp, from '/tmp/test.sdp':
  Metadata:
    title           : KMS
  Duration: N/A, start: 0.033000, bitrate: N/A
    Stream #0:0, 0, 1/44000: Audio: opus, 48000 Hz, mono, fltp
    Stream #0:1, 962, 1/90000: Video: vp8, 1 reference frame, none(progressive), 30 fps, 30 tbr, 90k tbn, 90k tbc
Successfully opened the file.
Parsing a group of options: output url output.mp4.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument libx264.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument aac.
Successfully parsed a group of options.
Opening an output file: output.mp4.
[file @ 0x55c234563320] Setting default whitelist 'file,crypto'
Successfully opened the file.
[libvpx @ 0x55c2344eb0e0] v1.7.0
[libvpx @ 0x55c2344eb0e0] --prefix=/usr --enable-pic --enable-shared --disable-install-bins --disable-install-srcs --size-limit=16384x16384 --enable-postproc --enable-multi-res-encoding --enable-temporal-denoising --enable-vp9-temporal-denoising --enable-vp9-postproc --target=x86_64-linux-gcc
Stream mapping:
  Stream #0:1 -> #0:0 (vp8 (libvpx) -> h264 (libx264))
  Stream #0:0 -> #0:1 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
Finishing stream 0:0 without any data written to it.
Finishing stream 0:1 without any data written to it.
detected 2 logical cores
[graph_1_in_0_0 @ 0x55c234561360] Setting 'time_base' to value '1/48000'
[graph_1_in_0_0 @ 0x55c234561360] Setting 'sample_rate' to value '48000'
[graph_1_in_0_0 @ 0x55c234561360] Setting 'sample_fmt' to value 'fltp'
[graph_1_in_0_0 @ 0x55c234561360] Setting 'channel_layout' to value '0x4'
[graph_1_in_0_0 @ 0x55c234561360] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x4
[format_out_0_1 @ 0x55c2345611e0] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 0x55c2345611e0] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[AVFilterGraph @ 0x55c234560620] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
Nothing was written into output file 0 (output.mp4), because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=-577014:32:22.77 bitrate=  -0.0kbits/s speed=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (/tmp/test.sdp):
  Input stream #0:0 (audio): 0 packets read (0 bytes); 0 frames decoded (0 samples);
  Input stream #0:1 (video): 0 packets read (0 bytes); 0 frames decoded;
  Total: 0 packets (0 bytes) demuxed
Output file #0 (output.mp4):
  Output stream #0:0 (video): 0 frames encoded; 0 packets muxed (0 bytes);
  Output stream #0:1 (audio): 0 frames encoded (0 samples); 0 packets muxed (0 bytes);
  Total: 0 packets (0 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x55c234563420] Statistics: 0 seeks, 0 writeouts
[aac @ 0x55c23458bea0] Qavg: -nan
[AVIOContext @ 0x55c2344ef6e0] Statistics: 305 bytes read, 0 seeks
Exiting normally, received signal 2.
root@app:/var/www# ls -lt
total 72
-rw-r--r-- 1 root root     0 Jul 15 09:12 output.mp4


    


  • FFMPEG fade in/out expressed in milliseconds

    22 juillet 2020, par orestino

    I working on a programmatic sketch to cut, crop and fade in/out audio from a single input video file.
Everything works pretty well except for the audio fade in fade out.

    


    Everything work fine if I set a fade in and fade out time of 1 (or more) seconds. Here's my command :

    


    ffmpeg -ss 0:1:11.10 -i INPUT_FILE.mp4 -filter:a afade=t=in:st=0:d=1.0,afade=t=out:st=55.867:d=1.0 -filter:v crop=720:720:138:0 -to 0:0:56.86 OUTPUT_FILE.mp4


    


    Fade filter stop working if I set time less than 1 secs (say 100ms like the following example).

    


    ffmpeg -ss 0:1:11.10 -i INPUT_FILE.mp4 -filter:a afade=t=in:st=0:d=0.1,afade=t=out:st=56.767:d=0.1 -filter:v crop=720:720:138:0 -to 0:0:56.86 OUTPUT_FILE.mov


    


    I mean, ffmpeg is not complaining about any error but the output video file simply has no fade in or fade out.

    


    Why ?
What I'm doing wrong ?

    


    Thank you so much for your support

    


    Edit 22/07/2020 :
here's the output from the second command :

    


    ffmpeg -ss 0:1:11.10 -i 2020-07-20_00-13-35.mkv -filter:a afade=t=in:st=0:d=0.1,afade=t=out:st=56.767:d=0.1 -filter:v crop=720:720:138:0 -to 0:0:56.86 ./_selections/2020-07-20_00-13-35_R1_crop2_w_fadein_fadeout_0:1:11.10.mov
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, matroska,webm, from '2020-07-20_00-13-35.mkv':
  Metadata:
    ENCODER         : Lavf57.83.100
  Duration: 00:03:19.23, start: 0.000000, bitrate: 2661 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1440x900, 30 fps, 30 tbr, 1k tbn, 60 tbc (default)
    Metadata:
      DURATION        : 00:03:19.233000000
    Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
    Metadata:
      title           : audio desktop
      DURATION        : 00:03:19.065000000
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x564dad2f9680] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x564dad2f9680] profile High, level 3.1
[libx264 @ 0x564dad2f9680] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mov, to './_selections/2020-07-20_00-13-35_R1_crop2_w_fadein_fadeout_0:1:11.10.mov':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 720x720, q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      DURATION        : 00:03:19.233000000
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      title           : audio desktop
      DURATION        : 00:03:19.065000000
      encoder         : Lavc57.107.100 aac
frame= 1706 fps=140 q=-1.0 Lsize=    2685kB time=00:00:56.86 bitrate= 386.7kbits/s speed=4.67x    
video:1681kB audio:942kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.351145%
[libx264 @ 0x564dad2f9680] frame I:7     Avg QP:15.76  size: 60653
[libx264 @ 0x564dad2f9680] frame P:448   Avg QP:23.13  size:  1372
[libx264 @ 0x564dad2f9680] frame B:1251  Avg QP:31.17  size:   545
[libx264 @ 0x564dad2f9680] consecutive B-frames:  1.3%  2.3%  1.4% 95.0%
[libx264 @ 0x564dad2f9680] mb I  I16..4: 29.2% 37.7% 33.1%
[libx264 @ 0x564dad2f9680] mb P  I16..4:  0.1%  0.4%  0.5%  P16..4:  2.1%  0.2%  0.2%  0.0%  0.0%    skip:96.4%
[libx264 @ 0x564dad2f9680] mb B  I16..4:  0.0%  0.3%  0.2%  B16..8:  1.5%  0.1%  0.1%  direct: 0.0%  skip:97.8%  L0:51.7% L1:46.3% BI: 2.0%
[libx264 @ 0x564dad2f9680] 8x8 transform intra:43.2% inter:27.7%
[libx264 @ 0x564dad2f9680] coded y,uvDC,uvAC intra: 35.4% 42.2% 40.1% inter: 0.3% 0.5% 0.3%
[libx264 @ 0x564dad2f9680] i16 v,h,dc,p: 61% 37%  2%  0%
[libx264 @ 0x564dad2f9680] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30%  7% 59%  2%  0%  0%  0%  1%  1%
[libx264 @ 0x564dad2f9680] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 17% 25% 10%  4%  5%  5%  7%  7%
[libx264 @ 0x564dad2f9680] i8c dc,h,v,p: 66% 19%  7%  7%
[libx264 @ 0x564dad2f9680] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x564dad2f9680] ref P L0: 65.1% 15.3% 13.6%  5.9%
[libx264 @ 0x564dad2f9680] ref B L0: 68.1% 27.1%  4.8%
[libx264 @ 0x564dad2f9680] ref B L1: 95.3%  4.7%
[libx264 @ 0x564dad2f9680] kb/s:242.09
[aac @ 0x564dad2f25a0] Qavg: 606.451


    


  • FFMPEG API Mp4 H264 Encoding/Muxing - unspecified pixel format

    28 juillet 2020, par Fabrice

    I'm working on a c++ project using ffmpeg. I have to generate an mp4 file with h264 encoding.

    


    My problem is that the file generate but when reading the file with VLC I've got no image, and analyzing it with ffprobe give me (log below) the error :

    


    


    unspecified pixel format

    


    


    ffprobe version N-93020-g3224d6691c Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20181201
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 44.100 / 58. 44.100
  libavformat    58. 26.100 / 58. 26.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[h264 @ 02a46240] non-existing PPS 0 referenced
[h264 @ 02a46240] decode_slice_header error
[h264 @ 02a46240] no frame!
...
[h264 @ 02a46240] non-existing PPS 0 referenced
[h264 @ 02a46240] decode_slice_header error
[h264 @ 02a46240] no frame!
[mov,mp4,m4a,3gp,3g2,mj2 @ 02a35380] decoding for stream 0 failed
[mov,mp4,m4a,3gp,3g2,mj2 @ 02a35380] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 352x288, 320 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\Fabrice\Desktop\video\Test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.26.100
  Duration: 00:00:09.00, start: 0.000000, bitrate: 323 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 352x288, 320 kb/s, 25.11 fps, 25 tbr, 12800 tbn, 25600 tbc (default)
    Metadata:
      handler_name    : VideoHandler


    


    Here is the code I use to genererate my mp4 File, it's based on sample from ffmpeg (see : FFMPEG Muxing sample). I have tried to adapt it without using deprecated function. It works using webm/vp8 encoding, but not mp4/h264.

    


    #include &#xA;#include &#xA;#include &#xA;extern "C"&#xA;{&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libswscale></libswscale>swscale.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavutil></libavutil>error.h> &#xA;#include <libavutil></libavutil>opt.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;}&#xA;&#xA;#pragma comment(lib, "avcodec.lib")&#xA;#pragma comment(lib, "swscale.lib")&#xA;#pragma comment(lib, "avformat.lib")&#xA;#pragma comment(lib, "avutil.lib")&#xA;&#xA;/* 10 seconds stream duration */&#xA;#define STREAM_DURATION   10.0&#xA;#define STREAM_FRAME_RATE 25 /* 25 images/s */&#xA;#define STREAM_NB_FRAMES  ((int)(STREAM_DURATION * STREAM_FRAME_RATE))&#xA;#define STREAM_PIX_FMT    AV_PIX_FMT_YUV420P /* default pix_fmt */&#xA;&#xA;//#pragma warning(disable : 4996) // TODO: remove&#xA;&#xA;static int sws_flags = SWS_BICUBIC;&#xA;&#xA;/* Add an output stream. */&#xA;static AVStream *add_stream(AVFormatContext *formatContext, AVCodec **codec, enum AVCodecID codecId, AVCodecContext **codecCtx)&#xA;{&#xA;    AVStream *stream;&#xA;&#xA;    // Get the encoder codec&#xA;    *codec = avcodec_find_encoder(codecId);&#xA;    if (!(*codec)) {&#xA;        fprintf(stderr, "Could not find encoder for &#x27;%s&#x27;\n",&#xA;            avcodec_get_name(codecId));&#xA;        exit(1);&#xA;    }&#xA;&#xA;    // Get the stream for codec&#xA;    stream = avformat_new_stream(formatContext, *codec);&#xA;    if (!stream) {&#xA;        fprintf(stderr, "Could not allocate stream\n");&#xA;        exit(1);&#xA;    }&#xA;    stream->id = formatContext->nb_streams - 1;&#xA;&#xA;    (*codecCtx) = avcodec_alloc_context3(*codec);&#xA;&#xA;    switch ((*codec)->type) {&#xA;    case AVMEDIA_TYPE_VIDEO:&#xA;        stream->codecpar->codec_id = codecId;&#xA;        stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;        stream->codecpar->bit_rate = 400000;&#xA;        stream->codecpar->width = 352;&#xA;        stream->codecpar->height = 288;&#xA;        stream->codecpar->format = STREAM_PIX_FMT;&#xA;        stream->time_base = { 1, STREAM_FRAME_RATE };&#xA;&#xA;        avcodec_parameters_to_context((*codecCtx), stream->codecpar);&#xA;        (*codecCtx)->gop_size = 12; /* emit one intra frame every twelve frames at most */&#xA;        (*codecCtx)->max_b_frames = 2;&#xA;        (*codecCtx)->time_base = { 1, STREAM_FRAME_RATE };&#xA;        if ((*codecCtx)->codec_id == AV_CODEC_ID_MPEG1VIDEO) {&#xA;            /* Needed to avoid using macroblocks in which some coeffs overflow.&#xA;             * This does not happen with normal video, it just happens here as&#xA;             * the motion of the chroma plane does not match the luma plane. */&#xA;            (*codecCtx)->mb_decision = 2;&#xA;        }&#xA;        break;&#xA;&#xA;    default:&#xA;        break;&#xA;    }&#xA;    &#xA;    //if (stream->codecpar->codec_id == AV_CODEC_ID_H264) {&#xA;    //  av_opt_set(codecCtx, "preset", "ultrafast", 0);&#xA;    //}&#xA;    //(*codecCtx)->flags |= AV_CODEC_FLAG_LOW_DELAY;&#xA;&#xA;    /* Some formats want stream headers to be separate. */&#xA;    if (formatContext->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;        (*codecCtx)->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;&#xA;&#xA;    int ret = avcodec_parameters_from_context(stream->codecpar, (*codecCtx));&#xA;    if (ret &lt; 0) {&#xA;        char error[255];&#xA;        av_strerror(ret, error, 255);&#xA;        fprintf(stderr, "avcodec_parameters_from_context returned (%d) - %s", ret, error);&#xA;        return false;&#xA;    }&#xA;&#xA;    return stream;&#xA;}&#xA;&#xA;/**************************************************************/&#xA;/* video output */&#xA;&#xA;static AVFrame *frame_video;&#xA;static int frame_count;&#xA;&#xA;static void open_video(AVCodec *codec, AVStream *stream, AVCodecContext *codecCtx)&#xA;{&#xA;    int ret;&#xA;&#xA;    /* open the codec */&#xA;    ret = avcodec_open2(codecCtx, codec, NULL);&#xA;    if (ret &lt; 0) {&#xA;        char error[255];&#xA;        av_strerror(ret, error, 255);&#xA;        fprintf(stderr, "Could not open video codec: %s\n", error);&#xA;        exit(1);&#xA;    }&#xA;&#xA;    /* allocate and init a re-usable frame */&#xA;    frame_video = av_frame_alloc();&#xA;    if (!frame_video) {&#xA;        fprintf(stderr, "Could not allocate video frame\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    frame_video->format = codecCtx->pix_fmt;&#xA;    frame_video->width = codecCtx->width;&#xA;    frame_video->height = codecCtx->height;&#xA;&#xA;    ret = av_frame_get_buffer(frame_video, 32);&#xA;    if (ret &lt; 0) {&#xA;        fprintf(stderr, "Could not allocate the video frame data\n");&#xA;        exit(1);&#xA;    }&#xA;}&#xA;&#xA;/* Prepare a dummy image. */&#xA;static void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height)&#xA;{&#xA;    int x, y, i;&#xA;&#xA;    i = frame_index;&#xA;&#xA;    /* Y */&#xA;    for (y = 0; y &lt; height; y&#x2B;&#x2B;)&#xA;        for (x = 0; x &lt; width; x&#x2B;&#x2B;)&#xA;            pict->data[0][y * pict->linesize[0] &#x2B; x] = x &#x2B; y &#x2B; i * 3;&#xA;&#xA;    /* Cb and Cr */&#xA;    for (y = 0; y &lt; height / 2; y&#x2B;&#x2B;) {&#xA;        for (x = 0; x &lt; width / 2; x&#x2B;&#x2B;) {&#xA;            pict->data[1][y * pict->linesize[1] &#x2B; x] = 128 &#x2B; y &#x2B; i * 2;&#xA;            pict->data[2][y * pict->linesize[2] &#x2B; x] = 64 &#x2B; x &#x2B; i * 5;&#xA;        }&#xA;    }&#xA;}&#xA;&#xA;int timestamp = 0;&#xA;static void write_video_frame(AVFormatContext *formatContext, AVStream *stream, AVCodecContext *codecCtx)&#xA;{&#xA;    int ret;&#xA;    static struct SwsContext *sws_ctx;&#xA;&#xA;    if (frame_count >= STREAM_NB_FRAMES) {&#xA;        /* No more frames to compress. The codec has a latency of a few&#xA;         * frames if using B-frames, so we get the last frames by&#xA;         * passing the same picture again. */&#xA;    }&#xA;    else {&#xA;        if (codecCtx->pix_fmt != AV_PIX_FMT_YUV420P) {&#xA;            /* as we only generate a YUV420P picture, we must convert it&#xA;             * to the codec pixel format if needed */&#xA;            if (!sws_ctx) {&#xA;                sws_ctx = sws_getContext(codecCtx->width, codecCtx->height, AV_PIX_FMT_YUV420P,&#xA;                    codecCtx->width, codecCtx->height, codecCtx->pix_fmt,&#xA;                    sws_flags, NULL, NULL, NULL);&#xA;                if (!sws_ctx) {&#xA;                    fprintf(stderr, "Could not initialize the conversion context\n");&#xA;                    exit(1);&#xA;                }&#xA;            }&#xA;            fill_yuv_image(frame_video, frame_count, codecCtx->width, codecCtx->height);&#xA;            sws_scale(sws_ctx, (const uint8_t * const *)frame_video->data, frame_video->linesize,&#xA;                0, codecCtx->height, frame_video->data, frame_video->linesize);&#xA;        }&#xA;        else {&#xA;            fill_yuv_image(frame_video, frame_count, codecCtx->width, codecCtx->height);&#xA;        }&#xA;    }&#xA;&#xA;    frame_video->format = AV_PIX_FMT_YUV420P;&#xA;    frame_video->width = codecCtx->width;&#xA;    frame_video->height = codecCtx->height;&#xA;&#xA;    if (formatContext->oformat->flags &amp; 0x0020) {&#xA;        /* Raw video case - directly store the picture in the packet */&#xA;        AVPacket pkt;&#xA;        av_init_packet(&amp;pkt);&#xA;&#xA;        pkt.flags |= AV_PKT_FLAG_KEY;&#xA;        pkt.stream_index = stream->index;&#xA;        pkt.data = frame_video->data[0];&#xA;        pkt.size = sizeof(AVPicture);&#xA;&#xA;        ret = av_interleaved_write_frame(formatContext, &amp;pkt);&#xA;    }&#xA;    else {&#xA;        AVPacket pkt = { 0 };&#xA;        av_init_packet(&amp;pkt);&#xA;&#xA;        /* encode the image */&#xA;        fprintf(stderr, "\nFrame type : %c\n", av_get_picture_type_char(frame_video->pict_type));&#xA;        fprintf(stderr, "Frame pts: %lld, \n", frame_video->pts);&#xA;        fprintf(stderr, "Codec timebase: %d/%d\n", codecCtx->time_base.num, codecCtx->time_base.den);&#xA;        fprintf(stderr, "Stream timebase: %d/%d\n", stream->time_base.num, stream->time_base.den);&#xA;        fprintf(stderr, "Resacale: %lld, \n\n", av_rescale_q(1, codecCtx->time_base, stream->time_base));&#xA;        ret = avcodec_send_frame(codecCtx, frame_video);&#xA;        if (ret &lt; 0) {&#xA;            char error[255];&#xA;            av_strerror(ret, error, 255);&#xA;            fprintf(stderr, "Error encoding video frame: %s\n", error);&#xA;            exit(1);&#xA;        }&#xA;        /* If size is zero, it means the image was buffered. */&#xA;        ret = avcodec_receive_packet(codecCtx, &amp;pkt);&#xA;        if (!ret &amp;&amp; pkt.size) {&#xA;            pkt.stream_index = stream->index;&#xA;            fprintf(stderr, "Packet flags : %d\n", pkt.flags);&#xA;            fprintf(stderr, "Packet pts: %lld\n", pkt.pts);&#xA;            fprintf(stderr, "Packet dts: %lld\n", pkt.dts);&#xA;            fprintf(stderr, "Packet duration: %lld\n", pkt.duration);&#xA;            fprintf(stderr, "Packet pos: %lld\n\n", pkt.pos);&#xA;            &#xA;            /* Write the compressed frame to the media file. */&#xA;            ret = av_interleaved_write_frame(formatContext, &amp;pkt);&#xA;        }&#xA;        else {&#xA;            ret = 0;&#xA;        }&#xA;    }&#xA;    if (ret != 0) {&#xA;        char error[255];&#xA;        av_strerror(ret, error, 255);&#xA;        fprintf(stderr, "Error while writing video frame: %s\n", error);&#xA;        exit(1);&#xA;    }&#xA;    frame_count&#x2B;&#x2B;;&#xA;}&#xA;&#xA;static void close_video(AVFormatContext *oc, AVStream *st)&#xA;{&#xA;    av_free(frame_video->data[0]);&#xA;    av_free(frame_video);&#xA;}&#xA;&#xA;/**************************************************************/&#xA;/* media file output */&#xA;&#xA;int main(int argc, char **argv)&#xA;{&#xA;    // The outputed media&#xA;    char filename[100];&#xA;    const char *mediaFormat = "mp4"; AVCodecID mediaVideoCodec = AV_CODEC_ID_H264;&#xA;    //const char *mediaFormat="webm"; AVCodecID mediaVideoCodec = AV_CODEC_ID_VP8;&#xA;    AVOutputFormat *formatOut;&#xA;    AVFormatContext *formatCtx;&#xA;&#xA;    // The video stream&#xA;    AVStream *stream_video;&#xA;    AVCodec *codec_video = nullptr;&#xA;    AVCodecContext *codecCtx_video = nullptr;&#xA;    double time_video = 0;&#xA;&#xA;    // Return code&#xA;    int ret;&#xA;&#xA;    strcpy_s(filename, "C:\\Test.");&#xA;    strcat_s(filename, mediaFormat);&#xA;&#xA;    // allocate the output media context&#xA;    avformat_alloc_output_context2(&amp;formatCtx, NULL, NULL, filename);&#xA;    if (!formatCtx) {&#xA;        return 1;&#xA;    }&#xA;    formatOut = formatCtx->oformat;&#xA;&#xA;    // Add the video stream using H264 codec&#xA;    stream_video = NULL;&#xA;    stream_video = add_stream(formatCtx, &amp;codec_video, mediaVideoCodec, &amp;codecCtx_video);&#xA;&#xA;    // Open video codec and allocate the necessary encode buffers&#xA;    if (stream_video)&#xA;        open_video(codec_video, stream_video, codecCtx_video);&#xA;&#xA;    av_dump_format(formatCtx, 0, filename, 1);&#xA;&#xA;    // Open the output media file, if needed&#xA;    if (!(formatOut->flags &amp; AVFMT_NOFILE)) {&#xA;        ret = avio_open(&amp;formatCtx->pb, filename, AVIO_FLAG_WRITE);&#xA;        if (ret &lt; 0) {&#xA;            char error[255];&#xA;            av_strerror(ret, error, 255);&#xA;            fprintf(stderr, "Could not open &#x27;%s&#x27;: %s\n", filename, error);&#xA;            return 1;&#xA;        }&#xA;    }&#xA;&#xA;    // Write media header&#xA;    ret = avformat_write_header(formatCtx, NULL);&#xA;    if (ret &lt; 0) {&#xA;        char error[255];&#xA;        av_strerror(ret, error, 255);&#xA;        fprintf(stderr, "Error occurred when opening output file: %s\n", error);&#xA;        return 1;&#xA;    }&#xA;&#xA;    if (frame_video)&#xA;        frame_video->pts = 0;&#xA;    for (;;) {&#xA;        // Compute video time from last added video frame&#xA;        time_video = ((double)frame_video->pts) * av_q2d(stream_video->time_base);&#xA;&#xA;        // Stop media if enough time&#xA;        if (!stream_video || time_video >= STREAM_DURATION)&#xA;            break;&#xA;&#xA;        // Add a video frame&#xA;        write_video_frame(formatCtx, stream_video, codecCtx_video);&#xA;&#xA;        // Increase frame pts according to time base&#xA;        frame_video->pts &#x2B;= av_rescale_q(1, codecCtx_video->time_base, stream_video->time_base);&#xA;    }&#xA;&#xA;    // Write media trailer&#xA;    av_write_trailer(formatCtx);&#xA;&#xA;    /* Close each codec. */&#xA;    if (stream_video)&#xA;        close_video(formatCtx, stream_video);&#xA;&#xA;    if (!(formatOut->flags &amp; AVFMT_NOFILE))&#xA;        /* Close the output file. */&#xA;        avio_close(formatCtx->pb);&#xA;&#xA;    /* free the stream */&#xA;    avformat_free_context(formatCtx);&#xA;&#xA;    return 0;&#xA;}&#xA;

    &#xA;

    What am I missing ? Which part give me this error ?

    &#xA;