Recherche avancée

Médias (1)

Mot : - Tags -/pirate bay

Autres articles (80)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (10664)

  • Is there a way to speed up the FFmpeg command '-filter_complex' ?

    31 août 2017, par Emma

    When using ffmpeg to re-encode videos, this is pretty fast. But when using the -filter_complex command the process slows down to real time. Is this process bound to the CPU or GPU ? Does anyone know if there is any way to speed this up using the GPU ?

    The full call is the following :

    ffmpeg.exe
    -i video_0_0.mp4 -i video_0_1.mp4 -i video_0_2.mp4 -i video_0_3.mp4
    -filter_complex
       "color=c=black:size=1920x1080 [base];
       [0:v] setpts=PTS-STARTPTS, scale=960x540 [upperleft];
       [1:v] setpts=PTS-STARTPTS, scale=960x540 [upperright];
       [2:v] setpts=PTS-STARTPTS, scale=960x540 [lowerleft];
       [3:v] setpts=PTS-STARTPTS, scale=960x540 [lowerright];
       [base][upperleft] overlay=shortest=1 [tmp1];
       [tmp1][upperright] overlay=shortest=1:x=960 [tmp2];
       [tmp2][lowerleft] overlay=shortest=1:y=540 [tmp3];
       [tmp3][lowerright] overlay=shortest=1:x=960:y=540"
    -q 4 -y
    "test.mp4"

    output of the command :

    ffmpeg.exe -i video_0_0.mp4 -i video_0_1.mp4 -i video_0_2.mp4 -i video_0_3.mp4 -filter_complex "color=c=black:size=1920x1080 [base]; [0:v] setpts=PTS-STARTPTS, scale=960x540 [upperleft]; [1:v] setpts=PTS-STARTPTS, scale=960x540 [upperright]; [2:v] setpts=PTS-STARTPTS, scale=960x540 [lowerleft]; [3:v] setpts=PTS-STARTPTS, scale=960x540 [lowerright]; [base][upperleft] overlay=shortest=1 [tmp1]; [tmp1][upperright] overlay=shortest=1:x=960 [tmp2]; [tmp2][lowerleft] overlay=shortest=1:y=540 [tmp3]; [tmp3][lowerright] overlay=shortest=1:x=960:y=540" -q 4 -y "test.mp4"
    ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 6.3.0 (GCC)
     configuration: --enable-gpl --enable-version3 --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
     libavutil      55. 34.101 / 55. 34.101
     libavcodec     57. 64.101 / 57. 64.101
     libavformat    57. 56.101 / 57. 56.101
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video_0_0.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.3.100
     Duration: 00:00:05.80, start: 0.000000, bitrate: 14 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], 12 kb/s, 10 fps, 10 tbr, 10240 tbn, 20 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    [h264 @ 000000000275a300] left block unavailable for requested intra mode
    [h264 @ 000000000275a300] error while decoding MB 0 21, bytestream 927
    [h264 @ 000000000275a300] concealing 1969 DC, 1969 AC, 1969 MV errors in I frame
    Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'video_0_1.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       title           : Session streamed with GStreamer
       encoder         : Lavf57.3.100
       comment         : rtsp-server
     Duration: 00:00:09.76, start: 0.000000, bitrate: 106 kb/s
       Stream #1:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1280x720 [SAR 1:1 DAR 16:9], 104 kb/s, 24.90 fps, 25 tbr, 90k tbn, 180k tbc (default)
       Metadata:
         handler_name    : VideoHandler
    [h264 @ 0000000002a2fb40] error while decoding MB 73 20, bytestream -7
    [h264 @ 0000000002a2fb40] concealing 1976 DC, 1976 AC, 1976 MV errors in I frame
    Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'video_0_2.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       title           : Session streamed with GStreamer
       encoder         : Lavf57.3.100
       comment         : rtsp-server
     Duration: 00:00:09.76, start: 0.000000, bitrate: 83 kb/s
       Stream #2:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1280x720 [SAR 1:1 DAR 16:9], 81 kb/s, 25.21 fps, 25 tbr, 90k tbn, 180k tbc (default)
       Metadata:
         handler_name    : VideoHandler
    [h264 @ 0000000002779920] error while decoding MB 22 29, bytestream -7
    [h264 @ 0000000002779920] concealing 1307 DC, 1307 AC, 1307 MV errors in I frame
    Input #3, mov,mp4,m4a,3gp,3g2,mj2, from 'video_0_3.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       title           : Session streamed with GStreamer
       encoder         : Lavf57.3.100
       comment         : rtsp-server
     Duration: 00:00:09.40, start: 0.000000, bitrate: 44 kb/s
       Stream #3:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1280x720 [SAR 1:1 DAR 16:9], 41 kb/s, 25.21 fps, 25 tbr, 90k tbn, 180k tbc (default)
       Metadata:
         handler_name    : VideoHandler
    [swscaler @ 000000000295a5e0] deprecated pixel format used, make sure you did set range correctly
    [swscaler @ 00000000029a64c0] deprecated pixel format used, make sure you did set range correctly
    [swscaler @ 00000000029d89c0] deprecated pixel format used, make sure you did set range correctly
    [swscaler @ 0000000002a7a160] deprecated pixel format used, make sure you did set range correctly
    [libx264 @ 0000000002a42080] -qscale is ignored, -crf is recommended.
    [libx264 @ 0000000002a42080] using SAR=1/1
    [libx264 @ 0000000002a42080] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0000000002a42080] profile High, level 4.0
    [libx264 @ 0000000002a42080] 264 - core 148 r2762 90a61ec - 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, mp4, to 'test.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.56.101
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
       Metadata:
         encoder         : Lavc57.64.101 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream mapping:
     Stream #0:0 (h264) -> setpts
     Stream #1:0 (h264) -> setpts
     Stream #2:0 (h264) -> setpts
     Stream #3:0 (h264) -> setpts
     overlay -> Stream #0:0 (libx264)
    Press [q] to stop, [?] for help
    [h264 @ 0000000002b12980] left block unavailable for requested intra mode
    [h264 @ 0000000002b12980] error while decoding MB 0 21, bytestream 927
    [h264 @ 0000000002b12980] concealing 1969 DC, 1969 AC, 1969 MV errors in I frame
    [h264 @ 0000000002b14b40] error while decoding MB 73 20, bytestream -7
    [h264 @ 0000000002b14b40] concealing 1976 DC, 1976 AC, 1976 MV errors in I frame
    [h264 @ 00000000029195e0] error while decoding MB 22 29, bytestream -7
    [h264 @ 00000000029195e0] concealing 1307 DC, 1307 AC, 1307 MV errors in I frame
    [h264 @ 0000000002b15000] left block unavailable for requested intra4x4 mode -1 0x
    [h264 @ 0000000002b15000] error while decoding MB 0 18, bytestream 293
    [h264 @ 0000000002b15000] concealing 2209 DC, 2209 AC, 2209 MV errors in I frame
    [h264 @ 0000000002b13800] left block unavailable for requested intra modeeed=   0x
    [h264 @ 0000000002b13800] error while decoding MB 0 10, bytestream 1778
    [h264 @ 0000000002b13800] concealing 2849 DC, 2849 AC, 2849 MV errors in I frame
    [h264 @ 000000000291c600] left block unavailable for requested intra modeeed=   0x
    [h264 @ 000000000291c600] error while decoding MB 0 32, bytestream 597
    [h264 @ 000000000291c600] concealing 1089 DC, 1089 AC, 1089 MV errors in I frame
    [h264 @ 0000000002b12e60] error while decoding MB 9 13, bytestream -5807.7kbits/s speed=0.0985x
    [h264 @ 0000000002b12e60] concealing 2600 DC, 2600 AC, 2600 MV errors in I frame
    [h264 @ 0000000002b12980] left block unavailable for requested intra4x4 mode -1/s speed=0.46x
    [h264 @ 0000000002b12980] error while decoding MB 0 3, bytestream 1575
    [h264 @ 0000000002b12980] concealing 3409 DC, 3409 AC, 3409 MV errors in I frame
    [h264 @ 0000000002b159a0] left block unavailable for requested intra mode
    [h264 @ 0000000002b159a0] error while decoding MB 0 14, bytestream 213
    [h264 @ 0000000002b159a0] concealing 2529 DC, 2529 AC, 2529 MV errors in I frame
    [h264 @ 0000000002918c40] error while decoding MB 63 30, bytestream -761.8kbits/s speed=0.642x
    [h264 @ 0000000002918c40] concealing 1186 DC, 1186 AC, 1186 MV errors in I frame
    [h264 @ 0000000002b14660] error while decoding MB 58 33, bytestream 222
    [h264 @ 0000000002b14660] concealing 951 DC, 951 AC, 951 MV errors in I frame
    [h264 @ 0000000002b15e80] left block unavailable for requested intra4x4 mode -1
    [h264 @ 0000000002b15e80] error while decoding MB 0 30, bytestream 863
    [h264 @ 0000000002b15e80] concealing 1249 DC, 1249 AC, 1249 MV errors in I frame
    frame=  143 fps= 25 q=-1.0 Lsize=     200kB time=00:00:05.60 bitrate= 293.2kbits/s speed=0.994x
    video:198kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.268034%
    [libx264 @ 0000000002a42080] frame I:1     Avg QP:14.64  size: 31429
    [libx264 @ 0000000002a42080] frame P:36    Avg QP:16.42  size:  3690
    [libx264 @ 0000000002a42080] frame B:106   Avg QP:18.41  size:   356
    [libx264 @ 0000000002a42080] consecutive B-frames:  0.7%  1.4%  0.0% 97.9%
    [libx264 @ 0000000002a42080] mb I  I16..4: 33.7% 58.7%  7.6%
    [libx264 @ 0000000002a42080] mb P  I16..4:  0.4%  1.0%  0.2%  P16..4:  6.0%  2.2%  1.5%  0.0%  0.0%    skip:88.7%
    [libx264 @ 0000000002a42080] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  4.3%  0.0%  0.0%  direct: 0.0%  skip:95.7%  L0:34.4% L1:65.5% BI: 0.1%
    [libx264 @ 0000000002a42080] 8x8 transform intra:59.7% inter:83.8%
    [libx264 @ 0000000002a42080] coded y,uvDC,uvAC intra: 34.4% 17.3% 7.8% inter: 0.6% 0.6% 0.0%
    [libx264 @ 0000000002a42080] i16 v,h,dc,p: 71% 17%  3% 10%
    [libx264 @ 0000000002a42080] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 47% 22% 15%  2%  3%  3%  3%  2%  2%
    [libx264 @ 0000000002a42080] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 47% 27% 11%  2%  4%  4%  3%  2%  1%
    [libx264 @ 0000000002a42080] i8c dc,h,v,p: 60% 24% 15%  1%
    [libx264 @ 0000000002a42080] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0000000002a42080] ref P L0: 84.6%  2.6% 10.6%  2.2%
    [libx264 @ 0000000002a42080] ref B L0: 58.1% 41.5%  0.5%
    [libx264 @ 0000000002a42080] ref B L1: 95.8%  4.2%
    [libx264 @ 0000000002a42080] kb/s:282.50
  • Unable to stream file onto localhost - ffmpeg

    18 octobre 2013, par trueblue

    I am new to ffmpeg/ffserver. I am trying to stream a local file named Trial onto a localhost using ffserver. I want to run the file in browser as http://localhost:8090/feed1.ffm
    I am executing the below command in Ubuntu(Trial is a Mpeg TS file) :

     ffmpeg -i Trial http://localhost:8090/feed1.ffm

    Upon execution of above command I am getting below error :

    FFmpeg version SVN-r0.5.9-4:0.5.9-0ubuntu0.10.04.3, Copyright (c) 2000-2009 Fabrice Bellard, et al.
     configuration: --extra-version=4:0.5.9-0ubuntu0.10.04.3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
     libavutil     49.15. 0 / 49.15. 0
     libavcodec    52.20. 1 / 52.20. 1
     libavformat   52.31. 0 / 52.31. 0
     libavdevice   52. 1. 0 / 52. 1. 0
     libavfilter    0. 4. 0 /  0. 4. 0
     libswscale     0. 7. 1 /  0. 7. 1
     libpostproc   51. 2. 0 / 51. 2. 0
     built on Jan 24 2013 19:42:59, gcc: 4.4.3

    Seems stream 0 codec frame rate differs from container frame rate: 119.88 (120000/1001) -> 59.94 (60000/1001)
    Input #0, mpegts, from 'Trial':
     Duration: 00:00:04.22, start: 0.177633, bitrate: 40368 kb/s
     Program 2
       Stream #0.0[0x21]: Video: mpeg2video, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 45000 kb/s, 59.94 tbr, 90k tbn, 119.88 tbc
    Output #0, ffm, to 'http://localhost:8090/feed1.ffm':
       Stream #0.0: Video: flv, yuv420p, 352x288, q=1-5, 100 kb/s, 1000k tbn, 15 tbc
       Stream #0.1: Audio: mp2, 44100 Hz, mono, s16, 32 kb/s
       Stream #0.2: Video: mpeg1video, yuv420p, 160x128, q=3-31, 64 kb/s, 1000k tbn, 3 tbc
       Stream #0.3: Audio: mp2, 22050 Hz, mono, s16, 64 kb/s
       Stream #0.4: Video: msmpeg4, yuv420p, 352x240, q=3-31, 256 kb/s, 1000k tbn, 15 tbc
    Could not find input stream matching output stream #0.1

    My ffserver.conf file goes like this :

    # Port on which the server is listening. You must select a different
    # port from your standard HTTP web server if it is running on the same
    # computer.
    Port 8090

    # Address on which the server is bound. Only useful if you have
    # several network interfaces.
    BindAddress 0.0.0.0

    # Number of simultaneous HTTP connections that can be handled. It has
    # to be defined *before* the MaxClients parameter, since it defines the
    # MaxClients maximum limit.
    MaxHTTPConnections 2000

    # Number of simultaneous requests that can be handled. Since FFServer
    # is very fast, it is more likely that you will want to leave this high
    # and use MaxBandwidth, below.
    MaxClients 1000

    # This the maximum amount of kbit/sec that you are prepared to
    # consume when streaming to clients.
    MaxBandwidth 1000

    # Access log file (uses standard Apache log file format)
    # '-' is the standard output.
    CustomLog -

    # Suppress that if you want to launch ffserver as a daemon.
    NoDaemon


    ##################################################################
    # Definition of the live feeds. Each live feed contains one video
    # and/or audio sequence coming from an ffmpeg encoder or another
    # ffserver. This sequence may be encoded simultaneously with several
    # codecs at several resolutions.

    <feed>

    # You must use &#39;ffmpeg&#39; to send a live feed to ffserver. In this
    # example, you can type:
    #
    # ffmpeg http://localhost:8090/feed1.ffm

    # ffserver can also do time shifting. It means that it can stream any
    # previously recorded live stream. The request should contain:
    # "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify
    # a path where the feed is stored on disk. You also specify the
    # maximum size of the feed, where zero means unlimited. Default:
    # File=/tmp/feed_name.ffm FileMaxSize=5M
    File /tmp/feed1.ffm
    FileMaxSize 5M

    # You could specify
    # ReadOnlyFile /saved/specialvideo.ffm
    # This marks the file as readonly and it will not be deleted or updated.

    # Specify launch in order to start ffmpeg automatically.
    # First ffmpeg must be defined with an appropriate path if needed,
    # after that options can follow, but avoid adding the http:// field
    #Launch ffmpeg

    # Only allow connections from localhost to the feed.
    ACL allow 127.0.0.1

    </feed>



    <stream>
    Feed feed1.ffm
    Format swf
    VideoCodec flv
    VideoFrameRate 15
    VideoBufferSize 80000
    VideoBitRate 100
    VideoQMin 1
    VideoQMax 5
    VideoSize 352x288
    PreRoll 0
    Noaudio
    </stream>

    ##################################################################
    # Now you can define each stream which will be generated from the
    # original audio and video stream. Each format has a filename (here
    # &#39;test1.mpg&#39;). FFServer will send this stream when answering a
    # request containing this filename.

    <stream>

    # coming from live feed &#39;feed1&#39;
    Feed feed1.ffm

    # Format of the stream : you can choose among:
    # mpeg       : MPEG-1 multiplexed video and audio
    # mpegvideo  : only MPEG-1 video
    # mp2        : MPEG-2 audio (use AudioCodec to select layer 2 and 3 codec)
    # ogg        : Ogg format (Vorbis audio codec)
    # rm         : RealNetworks-compatible stream. Multiplexed audio and video.
    # ra         : RealNetworks-compatible stream. Audio only.
    # mpjpeg     : Multipart JPEG (works with Netscape without any plugin)
    # jpeg       : Generate a single JPEG image.
    # asf        : ASF compatible streaming (Windows Media Player format).
    # swf        : Macromedia Flash compatible stream
    # avi        : AVI format (MPEG-4 video, MPEG audio sound)
    Format mpeg

    # Bitrate for the audio stream. Codecs usually support only a few
    # different bitrates.
    AudioBitRate 32

    # Number of audio channels: 1 = mono, 2 = stereo
    AudioChannels 1

    # Sampling frequency for audio. When using low bitrates, you should
    # lower this frequency to 22050 or 11025. The supported frequencies
    # depend on the selected audio codec.
    AudioSampleRate 44100

    # Bitrate for the video stream
    VideoBitRate 64


    # Ratecontrol buffer size
    VideoBufferSize 40

    # Number of frames per second
    VideoFrameRate 3

    # Size of the video frame: WxH (default: 160x128)
    # The following abbreviations are defined: sqcif, qcif, cif, 4cif, qqvga,
    # qvga, vga, svga, xga, uxga, qxga, sxga, qsxga, hsxga, wvga, wxga, wsxga,
    # wuxga, woxga, wqsxga, wquxga, whsxga, whuxga, cga, ega, hd480, hd720,
    # hd1080
    VideoSize 160x128

    # Transmit only intra frames (useful for low bitrates, but kills frame rate).
    #VideoIntraOnly

    # If non-intra only, an intra frame is transmitted every VideoGopSize
    # frames. Video synchronization can only begin at an intra frame.
    VideoGopSize 12

    # More MPEG-4 parameters
    # VideoHighQuality
    # Video4MotionVector

    # Choose your codecs:
    #AudioCodec mp2
    #VideoCodec mpeg1video

    # Suppress audio
    #NoAudio

    # Suppress video
    #NoVideo

    #VideoQMin 3
    #VideoQMax 31

    # Set this to the number of seconds backwards in time to start. Note that
    # most players will buffer 5-10 seconds of video, and also you need to allow
    # for a keyframe to appear in the data stream.
    #Preroll 15

    # ACL:

    # You can allow ranges of addresses (or single addresses)
    #ACL ALLOW <first address="address"> <last address="address">

    # You can deny ranges of addresses (or single addresses)
    #ACL DENY <first address="address"> <last address="address">

    # You can repeat the ACL allow/deny as often as you like. It is on a per
    # stream basis. The first match defines the action. If there are no matches,
    # then the default is the inverse of the last ACL statement.
    #
    # Thus &#39;ACL allow localhost&#39; only allows access from localhost.
    # &#39;ACL deny 1.0.0.0 1.255.255.255&#39; would deny the whole of network 1 and
    # allow everybody else.

    </last></first></last></first></stream>


    ##################################################################
    # Example streams


    # Multipart JPEG

    #<stream>
    #Feed feed1.ffm
    #Format mpjpeg
    #VideoFrameRate 2
    #VideoIntraOnly
    #NoAudio
    #Strict -1
    #</stream>


    # Single JPEG

    #<stream>
    #Feed feed1.ffm
    #Format jpeg
    #VideoFrameRate 2
    #VideoIntraOnly
    ##VideoSize 352x240
    #NoAudio
    #Strict -1
    #</stream>



    # Flash

    #<stream>
    #Feed feed1.ffm
    #Format swf
    #VideoFrameRate 2
    #VideoIntraOnly
    #NoAudio
    #</stream>


    # ASF compatible

    <stream>
    Feed feed1.ffm
    Format asf
    VideoFrameRate 15
    VideoSize 352x240
    VideoBitRate 256
    VideoBufferSize 40
    VideoGopSize 30
    AudioBitRate 64
    StartSendOnKey
    </stream>


    # MP3 audio

    #<stream>
    #Feed feed1.ffm
    #Format mp2
    #AudioCodec mp3
    #AudioBitRate 64
    #AudioChannels 1
    #AudioSampleRate 44100
    #NoVideo
    #</stream>


    # Ogg Vorbis audio

    #<stream>
    #Feed feed1.ffm
    #Title "Stream title"
    #AudioBitRate 64
    #AudioChannels 2
    #AudioSampleRate 44100
    #NoVideo
    #</stream>


    # Real with audio only at 32 kbits

    #<stream>
    #Feed feed1.ffm
    #Format rm
    #AudioBitRate 32
    #NoVideo
    #NoAudio
    #</stream>


    # Real with audio and video at 64 kbits

    #<stream>
    #Feed feed1.ffm
    #Format rm
    #AudioBitRate 32
    #VideoBitRate 128
    #VideoFrameRate 25
    #VideoGopSize 25
    #NoAudio
    #</stream>


    ##################################################################
    # A stream coming from a file: you only need to set the input
    # filename and optionally a new format. Supported conversions:
    #    AVI -> ASF

    #<stream>
    #File "/usr/local/httpd/htdocs/tlive.rm"
    #NoAudio
    #</stream>

    #<stream>
    #File "/usr/local/httpd/htdocs/test.asf"
    #NoAudio
    #Author "Me"
    #Copyright "Super MegaCorp"
    #Title "Test stream from disk"
    #Comment "Test comment"
    #</stream>


    ##################################################################
    # RTSP examples
    #
    # You can access this stream with the RTSP URL:
    #   rtsp://localhost:5454/test1-rtsp.mpg
    #
    # A non-standard RTSP redirector is also created. Its URL is:
    #   http://localhost:8090/test1-rtsp.rtsp

    #<stream>
    #Format rtp
    #File "/usr/local/httpd/htdocs/test1.mpg"
    #</stream>


    ##################################################################
    # SDP/multicast examples
    #
    # If you want to send your stream in multicast, you must set the
    # multicast address with MulticastAddress. The port and the TTL can
    # also be set.
    #
    # An SDP file is automatically generated by ffserver by adding the
    # &#39;sdp&#39; extension to the stream name (here
    # http://localhost:8090/test1-sdp.sdp). You should usually give this
    # file to your player to play the stream.
    #
    # The &#39;NoLoop&#39; option can be used to avoid looping when the stream is
    # terminated.

    #<stream>
    #Format rtp
    #File "/usr/local/httpd/htdocs/test1.mpg"
    #MulticastAddress 224.124.0.1
    #MulticastPort 5000
    #MulticastTTL 16
    #NoLoop
    #</stream>


    ##################################################################
    # Special streams

    # Server status

    <stream>
    Format status

    # Only allow local people to get the status
    ACL allow localhost
    ACL allow 192.168.0.0 192.168.255.255

    #FaviconURL http://pond1.gladstonefamily.net:8080/favicon.ico
    </stream>


    # Redirect index.html to the appropriate site

    <redirect>
    URL http://www.ffmpeg.org/
    </redirect>

    Kindly anyone please assist me whether I am missing something or do i need to change my server.conf file ? I have referred many websites. But still I am unable to fix it. Thanks in advance.

  • C++ ffmpeg Specified pixel format is invalid or not supported

    4 septembre 2022, par Turgut

    So I have a program that reads an opengl window and encodes the read data as a video. Now through a series of experimentation I have learned that the bit format of my glfw window is 8:8:8 as returned by glfwGetVideoMode(monitor). So I use this function to read the window :

    &#xA;

    glReadPixels(0, 0,gl_width, gl_height,GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*) Buffer);

    &#xA;

    and I simply encode it in the AV_PIX_FMT_YUV420P format.

    &#xA;

    Under normal circumstances this method works just fine. However, when I actually run the program, the output I get, as opposed to what I can see in the glfw window, is really low resolution and a bit pixelated.

    &#xA;

    Here is what my GLFW window looks like :&#xA;enter image description here

    &#xA;

    Now this is what I want it to look like. It looks just fine on the opengl window, and I encode it directly without altering Buffer.

    &#xA;

    And here is what the encoded result, test.mp4 looks like when I run it using mplayer or similar software :

    &#xA;

    enter image description here

    &#xA;

    It's a lot more blurry and pixelated compare to the GLFW window. With some experimentation and following an answer to another question I asked, I us avcodec_find_best_pix_fmt_of_list((*codec)->pix_fmts, AV_PIX_FMT_RGBA, 1, &amp;ret) and it returned 13. Which led me to believe using AV_PIX_FMT_YUVJ422P is the best option for this convertion to not have a blurry/pixelated result. However, no matter which function I pass, every single format gives off an error except AV_PIX_FMT_YUV420P. The error is :

    &#xA;

    [mpeg4 @ 0x558e74f47900] Specified pixel format yuvj422p is invalid or not supported&#xA;

    &#xA;

    I have no idea why this is happening, as the format is bound to a define and it is changed throughout the entire program when I change the define.

    &#xA;

    Here is my encoder so far (I have trimmed some parts) :

    &#xA;

    video_encoder.cpp :

    &#xA;

    int video_encoder::write_frame(AVFormatContext *fmt_ctx, AVCodecContext *c,&#xA;                       AVStream *st, AVFrame *frame, AVPacket *pkt)&#xA;    {&#xA;    int ret;&#xA;    // Conditional jump or move depends on uninitialised value&#xA;    // Use of uninitialised value of size 8&#xA;    // send the frame to the encoder&#xA;&#xA;    // Error is about c.&#xA;    ret = avcodec_send_frame(c, frame);&#xA;&#xA;    if (ret &lt; 0) {&#xA;        std::cout &lt;&lt; "Error sending a frame to the encoder: " &lt;&lt; ret &lt;&lt; std::endl;&#xA;        exit(1);&#xA;    }&#xA;&#xA;    while (ret >= 0) {&#xA;        ret = avcodec_receive_packet(c, pkt);&#xA;&#xA;        if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;            break;&#xA;        else if (ret &lt; 0) {&#xA;            std::cout &lt;&lt; "Error encoding a frame: " &lt;&lt; ret &lt;&lt; std::endl;&#xA;            exit(1);&#xA;        }&#xA;&#xA;        /* rescale output packet timestamp values from codec to stream timebase */&#xA;        av_packet_rescale_ts(pkt, c->time_base, st->time_base);&#xA;        pkt->stream_index = st->index;&#xA;&#xA;        /* Write the compressed frame to the media file. */&#xA;        //log_packet(fmt_ctx, pkt);&#xA;&#xA;        //std::cout &lt;&lt; "Packet: " &lt;&lt; pkt &lt;&lt; std::endl;&#xA;&#xA;        ret = av_interleaved_write_frame(fmt_ctx, pkt);&#xA;&#xA;        /* pkt is now blank (av_interleaved_write_frame() takes ownership of&#xA;         * its contents and resets pkt), so that no unreferencing is necessary.&#xA;         * This would be different if one used av_write_frame(). */&#xA;        if (ret &lt; 0) {&#xA;            std::cout &lt;&lt; "Error while writing output packet: " &lt;&lt; ret &lt;&lt; std::endl;&#xA;            exit(1);&#xA;        }&#xA;    }&#xA;&#xA;    return ret == AVERROR_EOF ? 1 : 0;&#xA;}&#xA;&#xA;&#xA;/* Add an output stream. */&#xA;void video_encoder::add_stream(OutputStream *ost, AVFormatContext *oc,&#xA;                       const AVCodec **codec,&#xA;                       enum AVCodecID codec_id)&#xA;{&#xA;    AVCodecContext *c;&#xA;    int i;&#xA;&#xA;    /* find the encoder */&#xA;    *codec = avcodec_find_encoder(codec_id);&#xA;    &#xA;    if (!(*codec)) {&#xA;        fprintf(stderr, "Could not find encoder for &#x27;%s&#x27;\n",&#xA;                avcodec_get_name(codec_id));&#xA;        exit(1);&#xA;    }&#xA;&#xA;    ost->tmp_pkt = av_packet_alloc();&#xA;&#xA;    if (!ost->tmp_pkt) {&#xA;        fprintf(stderr, "Could not allocate AVPacket\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    ost->st = avformat_new_stream(oc, NULL);&#xA;    if (!ost->st) {&#xA;        fprintf(stderr, "Could not allocate stream\n");&#xA;        exit(1);&#xA;    }&#xA;    ost->st->id = oc->nb_streams-1;&#xA;    c = avcodec_alloc_context3(*codec);&#xA;    if (!c) {&#xA;        fprintf(stderr, "Could not alloc an encoding context\n");&#xA;        exit(1);&#xA;    }&#xA;    ost->enc = c;&#xA;&#xA;&#xA;    switch ((*codec)->type) {&#xA;    case AVMEDIA_TYPE_AUDIO:&#xA;        ...&#xA;    case AVMEDIA_TYPE_VIDEO:&#xA;        c->codec_id = codec_id;&#xA;&#xA;        c->bit_rate = 10000;&#xA;        /* Resolution must be a multiple of two. */&#xA;        c->width    = width;&#xA;        c->height   = height;&#xA;        /* timebase: This is the fundamental unit of time (in seconds) in terms&#xA;         * of which frame timestamps are represented. For fixed-fps content,&#xA;         * timebase should be 1/framerate and timestamp increments should be&#xA;         * identical to 1. */&#xA;        ost->st->time_base = (AVRational){ 1, STREAM_FRAME_RATE }; // *frame_rate&#xA;        c->time_base       = ost->st->time_base;&#xA;&#xA;        c->gop_size      = 7; /* emit one intra frame every twelve frames at most */&#xA;        c->pix_fmt       = STREAM_PIX_FMT;&#xA;        //if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) &#xA;        //    c->max_b_frames = 2;&#xA;        if (c->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;            c->mb_decision = 2;&#xA;        }&#xA;&#xA;        if ((*codec)->pix_fmts){&#xA;            //c->pix_fmt = (*codec)->pix_fmts[0];&#xA;            std::cout &lt;&lt; "NEW FORMAT : " &lt;&lt; c->pix_fmt &lt;&lt; std::endl;&#xA;        }&#xA;&#xA;        int ret;&#xA;        avcodec_find_best_pix_fmt_of_list((*codec)->pix_fmts, AV_PIX_FMT_RGBA, 1, &amp;ret);&#xA;        std::cout &lt;&lt; "Desired format is: " &lt;&lt; ret &lt;&lt; std::endl;&#xA;        break;&#xA;    }&#xA;     &#xA;&#xA;    /* Some formats want stream headers to be separate. */&#xA;    if (oc->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;        c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;}&#xA;&#xA;/**************************************************************/&#xA;/* video output */&#xA;&#xA;AVFrame* video_encoder::alloc_picture(enum AVPixelFormat pix_fmt, int width, int height)&#xA;{&#xA;    AVFrame *picture;&#xA;    int ret;&#xA;&#xA;    picture = av_frame_alloc();&#xA;    if (!picture)&#xA;        return NULL;&#xA;&#xA;    picture->format = pix_fmt;&#xA;    picture->width  = width;&#xA;    picture->height = height;&#xA;&#xA;    /* allocate the buffers for the frame data */&#xA;    ret = av_frame_get_buffer(picture, 0);&#xA;    if (ret &lt; 0) {&#xA;        fprintf(stderr, "Could not allocate frame data.\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    return picture;&#xA;}&#xA;&#xA;void video_encoder::open_video(AVFormatContext *oc, const AVCodec *codec,&#xA;                       OutputStream *ost, AVDictionary *opt_arg)&#xA;{&#xA;    int ret;&#xA;    AVCodecContext *c = ost->enc;&#xA;    AVDictionary *opt = NULL;&#xA;    av_dict_copy(&amp;opt, opt_arg, 0);&#xA;    /* open the codec */&#xA;    ret = avcodec_open2(c, codec, &amp;opt);&#xA;    av_dict_free(&amp;opt);&#xA;    if (ret &lt; 0) {&#xA;        fprintf(stderr, "Could not open video codec: %s\n", ret);&#xA;        exit(1);&#xA;    }&#xA;&#xA;    /* allocate and init a re-usable frame */&#xA;    ost->frame = alloc_picture(c->pix_fmt, c->width, c->height);&#xA;    if (!ost->frame) {&#xA;        fprintf(stderr, "Could not allocate video frame\n");&#xA;        exit(1);&#xA;    }&#xA;&#xA;    /* If the output format is not YUV420P, then a temporary YUV420P&#xA;     * picture is needed too. It is then converted to the required&#xA;     * output format. */&#xA;    ost->tmp_frame = NULL;&#xA;&#xA;&#xA;    /* copy the stream parameters to the muxer */&#xA;    ret = avcodec_parameters_from_context(ost->st->codecpar, c);&#xA;    if (ret &lt; 0) {&#xA;        fprintf(stderr, "Could not copy the stream parameters\n");&#xA;        exit(1);&#xA;    }&#xA;}&#xA;&#xA;&#xA;void video_encoder::set_frame_yuv_from_rgb(AVFrame *frame, struct SwsContext *sws_context) {&#xA;    const int in_linesize[1] = { 4 * width };&#xA;    //uint8_t* dest[4] = { rgb_data, NULL, NULL, NULL };&#xA;&#xA;    &#xA;    sws_context = sws_getContext(&#xA;            width, height, AV_PIX_FMT_RGBA,&#xA;            width, height, STREAM_PIX_FMT,&#xA;            SCALE_FLAGS, 0, 0, 0);&#xA;&#xA;    sws_scale(sws_context, (const uint8_t * const *)&amp;rgb_data, in_linesize, 0,&#xA;            height, frame->data, frame->linesize);&#xA;}&#xA;&#xA;AVFrame* video_encoder::get_video_frame(OutputStream *ost)&#xA;{&#xA;    AVCodecContext *c = ost->enc;&#xA;    /* check if we want to generate more frames */&#xA;    if (av_compare_ts(ost->next_pts, c->time_base,&#xA;                      (float) STREAM_DURATION / 1000, (AVRational){ 1, 1 }) > 0)&#xA;        return NULL;&#xA;&#xA;    /* when we pass a frame to the encoder, it may keep a reference to it&#xA;     * internally; make sure we do not overwrite it here */&#xA;    if (av_frame_make_writable(ost->frame) &lt; 0)&#xA;        exit(1);&#xA;&#xA;        &#xA;    set_frame_yuv_from_rgb(ost->frame, ost->sws_ctx);&#xA;    &#xA;    &#xA;    ost->frame->pts = ost->next_pts&#x2B;&#x2B;;&#xA;&#xA;    return ost->frame;&#xA;}&#xA;&#xA;/*&#xA; * encode one video frame and send it to the muxer&#xA; * return 1 when encoding is finished, 0 otherwise&#xA; */&#xA;int video_encoder::write_video_frame(AVFormatContext *oc, OutputStream *ost)&#xA;{&#xA;    return write_frame(oc, ost->enc, ost->st, get_video_frame(ost), ost->tmp_pkt);&#xA;}&#xA;&#xA;void video_encoder::close_stream(AVFormatContext *oc, OutputStream *ost)&#xA;{&#xA;    avcodec_free_context(&amp;ost->enc);&#xA;    av_frame_free(&amp;ost->frame);&#xA;    av_frame_free(&amp;ost->tmp_frame);&#xA;    av_packet_free(&amp;ost->tmp_pkt);&#xA;    //sws_freeContext(ost->sws_ctx);&#xA;    //swr_free(&amp;ost->swr_ctx);&#xA;}&#xA;&#xA;/**************************************************************/&#xA;/* media file output */&#xA;&#xA;void video_encoder::set_encode_framebuffer(uint8_t* data, bool audio_only)&#xA;{&#xA;    rgb_data = data;&#xA;}&#xA;&#xA;video_encoder::~video_encoder()&#xA;{&#xA;    av_write_trailer(enc_inf.oc);&#xA;&#xA;    /* Close each codec. */&#xA;    if (enc_inf.have_video)&#xA;        close_stream(enc_inf.oc, &amp;enc_inf.video_st);&#xA;&#xA;    if (!(enc_inf.fmt->flags &amp; AVFMT_NOFILE))&#xA;        /* Close the output file. */&#xA;        avio_closep(&amp;enc_inf.oc->pb);&#xA;&#xA;    /* free the stream */&#xA;    avformat_free_context(enc_inf.oc);&#xA;    std::cout &lt;&lt; "Done, closing." &lt;&lt; std::endl;  &#xA;}&#xA;&#xA;bool video_encoder::encode_one_frame()&#xA;{&#xA;    if (enc_inf.encode_video || enc_inf.encode_audio) {&#xA;        /* select the stream to encode */&#xA;       if (enc_inf.encode_video &amp;&amp;&#xA;            (!enc_inf.encode_audio || av_compare_ts(enc_inf.video_st.next_pts, enc_inf.video_st.enc->time_base,&#xA;                                            enc_inf.audio_st.next_pts, enc_inf.audio_st.enc->time_base) &lt;= 0)) {&#xA;            enc_inf.encode_video = !write_video_frame(enc_inf.oc, &amp;enc_inf.video_st);&#xA;            return true;&#xA;        } &#xA;    }&#xA;    return false;&#xA;}&#xA;&#xA;&#xA;video_encoder::video_encoder(int w, int h, float fps, unsigned int duration) &#xA; :width(w), height(h), STREAM_FRAME_RATE(fps), STREAM_DURATION(duration)&#xA;{&#xA;    //std::filesystem::create_directory("media"); &#xA;&#xA;    //std::string as_str = "./output/" &#x2B; std::string(getenv ("OUTPUT_UUID")) &#x2B; ".mp4";&#xA;    std::string as_str = "./output/video.mp4";&#xA;&#xA;    char* filename = const_cast(as_str.c_str());&#xA;    enc_inf.video_st, enc_inf.audio_st = (struct OutputStream) { 0 };&#xA;    enc_inf.video_st.next_pts = 1; &#xA;    enc_inf.audio_st.next_pts = 1;&#xA;    enc_inf.encode_audio, enc_inf.encode_video = 0;&#xA;    int ret;&#xA;    int i;&#xA;    //rgb_data = (uint8_t*)malloc( 48 * sizeof(uint8_t) );&#xA;&#xA;    /* allocate the output media context */&#xA;    avformat_alloc_output_context2(&amp;enc_inf.oc, NULL, NULL, filename);&#xA;&#xA;    if (!enc_inf.oc) {&#xA;        //VI_ERROR("Could not deduce output format from file extension: using MPEG.\n");&#xA;        avformat_alloc_output_context2(&amp;enc_inf.oc, NULL, "mpeg", filename);&#xA;    }&#xA;    if (!enc_inf.oc)&#xA;        std::cout &lt;&lt; "FAILED" &lt;&lt; std::endl;&#xA;        //return 1;&#xA;&#xA;    enc_inf.fmt = enc_inf.oc->oformat;&#xA;&#xA;    /* Add the audio and video streams using the default format codecs&#xA;     * and initialize the codecs. */&#xA;    if (enc_inf.fmt->video_codec != AV_CODEC_ID_NONE) {&#xA;        add_stream(&amp;enc_inf.video_st, enc_inf.oc, &amp;video_codec, enc_inf.fmt->video_codec);&#xA;        enc_inf.have_video = 1;&#xA;        enc_inf.encode_video = 1;&#xA;    }&#xA;&#xA;    /* Now that all the parameters are set, we can open the audio and&#xA;     * video codecs and allocate the necessary encode buffers. */&#xA;    if (enc_inf.have_video)&#xA;        open_video(enc_inf.oc, video_codec, &amp;enc_inf.video_st, opt);&#xA;&#xA;    /* open the output file, if needed */&#xA;    if (!(enc_inf.fmt->flags &amp; AVFMT_NOFILE)) {&#xA;        ret = avio_open(&amp;enc_inf.oc->pb, filename, AVIO_FLAG_WRITE);&#xA;        if (ret &lt; 0) {&#xA;            //VI_ERROR("Could not open &#x27;%s&#x27;: %s\n", filename, ret);&#xA;            //return 1;&#xA;        }&#xA;    }&#xA;&#xA;    /* Write the stream header, if any. */&#xA;    ret = avformat_write_header(enc_inf.oc, &amp;opt);&#xA;    if (ret &lt; 0) {&#xA;        VI_ERROR("Error occurred when opening output file:");&#xA;        //return 1;&#xA;    }&#xA;    &#xA;    //return 0;&#xA;}&#xA;

    &#xA;

    video_encoder.h :

    &#xA;

    #define STREAM_PIX_FMT AV_PIX_FMT_YUV420P /* default pix_fmt */&#xA;&#xA;#define SCALE_FLAGS SWS_SPLINE&#xA;&#xA;/* The output bit rate in bit/s */&#xA;#define OUTPUT_BIT_RATE 96000&#xA;/* The number of output channels */&#xA;#define OUTPUT_CHANNELS 2&#xA;&#xA;typedef struct OutputStream {&#xA;    AVStream *st;&#xA;    AVCodecContext *enc;&#xA;&#xA;    /* pts of the next frame that will be generated */&#xA;    int64_t next_pts;&#xA;    int samples_count;&#xA;&#xA;    AVFrame *frame;&#xA;    AVFrame *tmp_frame;&#xA;&#xA;    AVPacket *tmp_pkt;&#xA;&#xA;    float t, tincr, tincr2;&#xA;&#xA;    struct SwsContext *sws_ctx;&#xA;    struct SwrContext *swr_ctx;&#xA;} OutputStream;&#xA;        typedef struct {&#xA;            OutputStream video_st, audio_st;&#xA;            const AVOutputFormat *fmt;&#xA;            AVFormatContext *oc;&#xA;            int have_video, have_audio, encode_video, encode_audio;&#xA;            std::string name;&#xA;        } encode_info;&#xA;

    &#xA;

    Again, changing STREAM_PIX_FMT anything other than AV_PIX_FMT_YUV420P causes the program to give the error.

    &#xA;

    What is the cause of this and how can I fix this ? Also am I on the right track for fixing the pixelation problem ? I'm using ubuntu.

    &#xA;