Recherche avancée

Médias (91)

Autres articles (32)

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

  • Mise à disposition des fichiers

    14 avril 2011, par

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

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, 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 (4008)

  • Desktop streaming to Wowza server using ffmpeg

    24 avril 2013, par Gergely Lukacsy

    Recently, I'm trying to utilize ffmpeg for streaming live desktop screen to a Wowza media server.

    I have partial success on the subject so far :

    I've managed to record desktop screen using the UScreenCapture directx dshow filter, and I'm also able to send this record to the server.
    However, when I'm trying to send the screen directly to the server, it fails every time. The player is buffering pretty slowly, and shows a blank screen when it's done (the counter keeps counting).

    So, here are the working methods

    for recording screen :

    ffmpeg -f dshow -i video="UScreenCapture" -r 25 -vcodec libx264 output.flv

    and for streaming video :

    ffmpeg -re -i  -map 0 -c copy -vbsf h264_mp4toannexb -f mpegts udp://stream.server.xyz:52000?pkt_size=1024

    And this is the code I'm using :

    ffmpeg -f dshow -i video="UScreenCapture" -s width x height -r framerate -vcodec libx264 -pix_fmt yuv420p -b:v bitrate -an -vbsf h264_mp4toannexb -f mpegts udp ://your.destination.url:PORTNUMBER ?pkt_size=some_bytes

    As far as I can remember, it worked well before I upgraded wowza.

    Some additional info :

    • OS : win7 sp1 64bit
    • ffmpeg N-49610-gc2dd5a1 (Zeranoe FFmpeg build 2013 Feb 5)
    • UScreenCapture : x64 Edition Version 2.0.14
    • Wowza 3.5.2 running on a Debian linux 2.6.32-5-amd64
    • Flowplayer : 3.2.15

    Looking trough the Wowza log files, something caught my attention. It seems when I'm streaming desktop screen, the server somhow gets uncomplete packets, but when I'm streaming a video file, the error doesn't occurs.

    RTPDePacketizerMPEGTS.handleRTPPacket
    WARN server comment 2013-04-11 11:26:24 - - - - - 152629.665 - - - - - - - -RTPDePacketizerMPEGTS.handleRTPPacket: Incomplete packet: 1504:1472
    WARN server comment 2013-04-11 11:26:27 - - - - - 152632.782 - - - - - - - -RTPDePacketizerMPEGTS.handleRTPPacket: Incomplete packet: 1504:1472
    WARN server comment 2013-04-11 11:26:31 - - - - - 152636.383 - - - - - - - -RTPDePacketizerMPEGTS.handleRTPPacket: Incomplete packet: 1504:1472
    WARN server comment 2013-04-11 11:26:38 - - - - - 152643.484 - - - - - - - -RTPDePacketizerMPEGTS.handleRTPPacket: Incomplete packet: 1504:1472
    WARN server comment 2013-04-11 11:26:47 - - - - - 152653.088 - - - - - - - -RTPDePacketizerMPEGTS.handleRTPPacket: Incomplete packet: 1504:1472
    WARN server comment 2013-04-11 11:26:52 - - - - - 152657.587 - - - - - - - -RTPDePacketizerMPEGTS.handleRTPPacket: Incomplete packet: 1504:1472
    WARN server comment 2013-04-11 11:26:56 - - - - - 152661.624 - - - - - - - -RTPDePacketizerMPEGTS.handleRTPPacket: Incomplete packet: 1504:1472
    WARN server comment 2013-04-11 11:27:05 - - - - - 152670.805 - - - - - - - -RTPDePacketizerMPEGTS.handleRTPPacket: Incomplete packet: 1504:1472

    What causes this error ? Any ideas ?

    Thanks in advance !

  • Why JPEG image looks different in two videos ?

    28 septembre 2015, par user606521

    I have two frames :

    f1.jpg
    f1.jpg
    f2.jpg
    f2.jpg

    And I am creating two videos :

    ./ffmpeg -i ./f%d.jpg -r 30 -y m1.mp4 # both frames 1 and 2
    ./ffmpeg -i ./f2.jpg -r 30 -y m2.mp4 # only frame 2

    For some reason frame 2 looks different in these two videos

    Frame 2 from m1.mp4 :

    $ ./ffmpeg -i m1.mp4 out1_%d.jpg
    ffmpeg version 2.7.2 Copyright (c) 2000-2015 the FFmpeg developers
     built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
     configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect
     libavutil      54. 27.100 / 54. 27.100
     libavcodec     56. 41.100 / 56. 41.100
     libavformat    56. 36.100 / 56. 36.100
     libavdevice    56.  4.100 / 56.  4.100
     libavfilter     5. 16.101 /  5. 16.101
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  2.100 /  1.  2.100
     libpostproc    53.  3.100 / 53.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'm1.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf56.36.100
     Duration: 00:00:00.07, start: 0.000000, bitrate: 478 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 980x100, 381 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    [swscaler @ 0x7f7f9a000600] deprecated pixel format used, make sure you did set range correctly
    Output #0, image2, to 'out1_%d.jpg':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf56.36.100
       Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 980x100, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc56.41.100 mjpeg
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
    Press [q] to stop, [?] for help
    frame=    2 fps=0.0 q=1.6 Lsize=N/A time=00:00:00.06 bitrate=N/A    
    video:6kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

    f1_out.jpg

    Frame 2 from m2.mp4 :

    $ ./ffmpeg -i m2.mp4 out2_%d.jpg
    ffmpeg version 2.7.2 Copyright (c) 2000-2015 the FFmpeg developers
     built with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
     configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --enable-libvidstab --enable-libx265 --disable-doc --arch=x86_64 --enable-runtime-cpudetect
     libavutil      54. 27.100 / 54. 27.100
     libavcodec     56. 41.100 / 56. 41.100
     libavformat    56. 36.100 / 56. 36.100
     libavdevice    56.  4.100 / 56.  4.100
     libavfilter     5. 16.101 /  5. 16.101
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  2.100 /  1.  2.100
     libpostproc    53.  3.100 / 53.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'm2.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf56.36.100
     Duration: 00:00:00.03, start: 0.000000, bitrate: 824 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 980x100 [SAR 1:1 DAR 49:5], 648 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    Output #0, image2, to 'out2_%d.jpg':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf56.36.100
       Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 980x100 [SAR 1:1 DAR 49:5], q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc56.41.100 mjpeg
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
    Press [q] to stop, [?] for help
    frame=    1 fps=0.0 q=1.6 Lsize=N/A time=00:00:00.03 bitrate=N/A    
    video:4kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

    f2_out.jpg

    It seems that frame 2 looks different when combined with frame 1 in a video. One thing I noticed that when dumping frames from m1.mp4 (two frames combined) there is a warning in ffmpeg output :

    [swscaler @ 0x7f7f9a000600] deprecated pixel format used, make sure you did set range correctly

    Also two frame images have same dimmensions (980x100) and their format seems to be same :

    $ file -b f1.jpg
    JPEG image data, JFIF standard 1.01, comment: "CS=ITU601??"
    $ file -b f2.jpg
    JPEG image data, JFIF standard 1.01

    So why this is happening ? I am struggling with this issue for quite a long time - for some reason some JPEGs somehow are in different "format ?" than others and make mess in videos...


    You can download first two images included in this question and test commands on your own.


    $ identify -verbose f1.jpg
    Image: f1.jpg
     Format: JPEG (Joint Photographic Experts Group JFIF format)
     Mime type: image/jpeg
     Class: DirectClass
     Geometry: 980x100+0+0
     Resolution: 552x551
     Print size: 1.77536x0.181488
     Units: PixelsPerInch
     Type: Palette
     Endianess: Undefined
     Colorspace: sRGB
     Depth: 8-bit
     Channel depth:
       red: 8-bit
       green: 8-bit
       blue: 8-bit
     Channel statistics:
       Red:
         min: 189 (0.741176)
         max: 233 (0.913725)
         mean: 208.261 (0.81671)
         standard deviation: 14.1741 (0.0555848)
         kurtosis: -1.40078
         skewness: 0.332664
       Green:
         min: 189 (0.741176)
         max: 233 (0.913725)
         mean: 208.261 (0.81671)
         standard deviation: 14.1741 (0.0555848)
         kurtosis: -1.40078
         skewness: 0.332664
       Blue:
         min: 189 (0.741176)
         max: 233 (0.913725)
         mean: 208.26 (0.816706)
         standard deviation: 14.1756 (0.0555905)
         kurtosis: -1.40068
         skewness: 0.332424
     Image statistics:
       Overall:
         min: 189 (0.741176)
         max: 233 (0.913725)
         mean: 208.261 (0.816709)
         standard deviation: 14.1746 (0.0555867)
         kurtosis: -1.40075
         skewness: 0.332584
     Colors: 47
     Histogram:
          368: (189,189,189) #BDBDBD grey74
         1984: (190,190,190) #BEBEBE grey
           28: (191,191,189) #BFBFBD srgb(191,191,189)
         3780: (191,191,191) #BFBFBF grey75
           28: (192,192,190) #C0C0BE srgb(192,192,190)
         6628: (192,192,192) #C0C0C0 silver
         5664: (193,193,193) #C1C1C1 srgb(193,193,193)
         4608: (194,194,194) #C2C2C2 grey76
         4480: (195,195,195) #C3C3C3 srgb(195,195,195)
         3328: (196,196,196) #C4C4C4 grey77
         2592: (197,197,197) #C5C5C5 srgb(197,197,197)
         3072: (198,198,198) #C6C6C6 srgb(198,198,198)
         2272: (199,199,199) #C7C7C7 grey78
         2112: (200,200,200) #C8C8C8 srgb(200,200,200)
         2112: (201,201,201) #C9C9C9 grey79
         1920: (202,202,202) #CACACA srgb(202,202,202)
         1728: (203,203,203) #CBCBCB srgb(203,203,203)
         1760: (204,204,204) #CCCCCC grey80
         1696: (205,205,205) #CDCDCD srgb(205,205,205)
         1248: (206,206,206) #CECECE srgb(206,206,206)
         1536: (207,207,207) #CFCFCF grey81
         1504: (208,208,208) #D0D0D0 srgb(208,208,208)
         1344: (209,209,209) #D1D1D1 grey82
         1536: (210,210,210) #D2D2D2 srgb(210,210,210)
         1472: (211,211,211) #D3D3D3 LightGray
         1088: (212,212,212) #D4D4D4 grey83
         1472: (213,213,213) #D5D5D5 srgb(213,213,213)
         1536: (214,214,214) #D6D6D6 grey84
         1344: (215,215,215) #D7D7D7 srgb(215,215,215)
         1184: (216,216,216) #D8D8D8 srgb(216,216,216)
         1408: (217,217,217) #D9D9D9 grey85
         1472: (218,218,218) #DADADA srgb(218,218,218)
         1216: (219,219,219) #DBDBDB grey86
         1280: (220,220,220) #DCDCDC gainsboro
         1536: (221,221,221) #DDDDDD srgb(221,221,221)
         1472: (222,222,222) #DEDEDE grey87
         1600: (223,223,223) #DFDFDF srgb(223,223,223)
         1696: (224,224,224) #E0E0E0 grey88
         1792: (225,225,225) #E1E1E1 srgb(225,225,225)
         1728: (226,226,226) #E2E2E2 srgb(226,226,226)
         1952: (227,227,227) #E3E3E3 grey89
         2272: (228,228,228) #E4E4E4 srgb(228,228,228)
         2752: (229,229,229) #E5E5E5 grey90
         4512: (230,230,230) #E6E6E6 srgb(230,230,230)
         4672: (231,231,231) #E7E7E7 srgb(231,231,231)
          640: (232,232,232) #E8E8E8 grey91
          576: (233,233,233) #E9E9E9 srgb(233,233,233)
     Rendering intent: Perceptual
     Gamma: 0.454545
     Chromaticity:
       red primary: (0.64,0.33)
       green primary: (0.3,0.6)
       blue primary: (0.15,0.06)
       white point: (0.3127,0.329)
     Background color: white
     Border color: srgb(223,223,223)
     Matte color: grey74
     Transparent color: black
     Interlace: None
     Intensity: Undefined
     Compose: Over
     Page geometry: 980x100+0+0
     Dispose: Undefined
     Iterations: 0
     Compression: JPEG
     Orientation: Undefined
     Properties:
       comment: CS=ITU601
       date:create: 2015-09-28T21:47:26+02:00
       date:modify: 2015-09-28T21:47:26+02:00
       jpeg:colorspace: 2
       jpeg:quality: 92
       jpeg:sampling-factor: 2x2,1x1,1x1
       signature: ca599d8ad07c79b36837cb9f4811d83e236b8d4a4cdfada8d60c4aa330f28f38
     Artifacts:
       filename: f1.jpg
       verbose: true
     Tainted: False
     Filesize: 1.36KB
     Number pixels: 98K
     Pixels per second: 9.8MB
     User time: 0.000u
     Elapsed time: 0:01.009
     Version: ImageMagick 6.8.7-0 2013-10-28 Q16 http://www.imagemagick.org

    $ identify -verbose f2.jpg
    Image: f2.jpg
     Format: JPEG (Joint Photographic Experts Group JFIF format)
     Mime type: image/jpeg
     Class: DirectClass
     Geometry: 980x100+0+0
     Resolution: 72x72
     Print size: 13.6111x1.38889
     Units: PixelsPerInch
     Type: Palette
     Endianess: Undefined
     Colorspace: sRGB
     Depth: 8-bit
     Channel depth:
       red: 8-bit
       green: 8-bit
       blue: 8-bit
     Channel statistics:
       Red:
         min: 186 (0.729412)
         max: 254 (0.996078)
         mean: 242.844 (0.952329)
         standard deviation: 11.0845 (0.0434688)
         kurtosis: 4.24417
         skewness: -2.17102
       Green:
         min: 186 (0.729412)
         max: 254 (0.996078)
         mean: 242.844 (0.952329)
         standard deviation: 11.0845 (0.0434688)
         kurtosis: 4.24417
         skewness: -2.17102
       Blue:
         min: 186 (0.729412)
         max: 254 (0.996078)
         mean: 242.842 (0.952323)
         standard deviation: 11.0886 (0.0434848)
         kurtosis: 4.24235
         skewness: -2.17103
     Image statistics:
       Overall:
         min: 186 (0.729412)
         max: 254 (0.996078)
         mean: 242.843 (0.952327)
         standard deviation: 11.0859 (0.0434741)
         kurtosis: 4.24356
         skewness: -2.17102
     Colors: 91
     Histogram:
            2: (186,186,186) #BABABA grey73
            2: (187,187,187) #BBBBBB srgb(187,187,187)
            1: (189,189,189) #BDBDBD grey74
            5: (190,190,190) #BEBEBE grey
            2: (191,191,191) #BFBFBF grey75
           20: (192,192,192) #C0C0C0 silver
           28: (193,193,193) #C1C1C1 srgb(193,193,193)
           37: (194,194,194) #C2C2C2 grey76
           46: (195,195,195) #C3C3C3 srgb(195,195,195)
           59: (196,196,196) #C4C4C4 grey77
          108: (197,197,197) #C5C5C5 srgb(197,197,197)
          134: (198,198,198) #C6C6C6 srgb(198,198,198)
          145: (199,199,199) #C7C7C7 grey78
          188: (200,200,200) #C8C8C8 srgb(200,200,200)
          230: (201,201,201) #C9C9C9 grey79
          241: (202,202,202) #CACACA srgb(202,202,202)
          236: (203,203,203) #CBCBCB srgb(203,203,203)
          252: (204,204,204) #CCCCCC grey80
          240: (205,205,205) #CDCDCD srgb(205,205,205)
          243: (206,206,206) #CECECE srgb(206,206,206)
            1: (207,207,205) #CFCFCD srgb(207,207,205)
          250: (207,207,207) #CFCFCF grey81
            1: (208,208,206) #D0D0CE srgb(208,208,206)
          267: (208,208,208) #D0D0D0 srgb(208,208,208)
            2: (209,209,207) #D1D1CF srgb(209,209,207)
          226: (209,209,209) #D1D1D1 grey82
            3: (210,210,208) #D2D2D0 srgb(210,210,208)
          193: (210,210,210) #D2D2D2 srgb(210,210,210)
            5: (211,211,209) #D3D3D1 srgb(211,211,209)
          215: (211,211,211) #D3D3D3 LightGray
            7: (212,212,210) #D4D4D2 srgb(212,212,210)
          227: (212,212,212) #D4D4D4 grey83
           11: (213,213,211) #D5D5D3 srgb(213,213,211)
          250: (213,213,213) #D5D5D5 srgb(213,213,213)
            4: (214,214,212) #D6D6D4 srgb(214,214,212)
          291: (214,214,214) #D6D6D6 grey84
           16: (215,215,213) #D7D7D5 srgb(215,215,213)
          307: (215,215,215) #D7D7D7 srgb(215,215,215)
            1: (216,216,214) #D8D8D6 srgb(216,216,214)
          371: (216,216,216) #D8D8D8 srgb(216,216,216)
            4: (217,217,215) #D9D9D7 srgb(217,217,215)
          355: (217,217,217) #D9D9D9 grey85
            3: (218,218,216) #DADAD8 srgb(218,218,216)
          398: (218,218,218) #DADADA srgb(218,218,218)
            3: (219,219,217) #DBDBD9 srgb(219,219,217)
          404: (219,219,219) #DBDBDB grey86
            5: (220,220,218) #DCDCDA srgb(220,220,218)
          435: (220,220,220) #DCDCDC gainsboro
            1: (221,221,219) #DDDDDB srgb(221,221,219)
          489: (221,221,221) #DDDDDD srgb(221,221,221)
            2: (222,222,220) #DEDEDC srgb(222,222,220)
          569: (222,222,222) #DEDEDE grey87
            1: (223,223,221) #DFDFDD srgb(223,223,221)
          552: (223,223,223) #DFDFDF srgb(223,223,223)
            2: (224,224,222) #E0E0DE srgb(224,224,222)
          595: (224,224,224) #E0E0E0 grey88
            2: (225,225,223) #E1E1DF srgb(225,225,223)
          645: (225,225,225) #E1E1E1 srgb(225,225,225)
          736: (226,226,226) #E2E2E2 srgb(226,226,226)
            3: (227,227,225) #E3E3E1 srgb(227,227,225)
          646: (227,227,227) #E3E3E3 grey89
            1: (228,228,226) #E4E4E2 srgb(228,228,226)
          707: (228,228,228) #E4E4E4 srgb(228,228,228)
            1: (229,229,227) #E5E5E3 srgb(229,229,227)
          667: (229,229,229) #E5E5E5 grey90
            1: (230,230,228) #E6E6E4 srgb(230,230,228)
          759: (230,230,230) #E6E6E6 srgb(230,230,230)
          767: (231,231,231) #E7E7E7 srgb(231,231,231)
          788: (232,232,232) #E8E8E8 grey91
          862: (233,233,233) #E9E9E9 srgb(233,233,233)
          880: (234,234,234) #EAEAEA srgb(234,234,234)
          889: (235,235,235) #EBEBEB grey92
          863: (236,236,236) #ECECEC srgb(236,236,236)
          868: (237,237,237) #EDEDED grey93
         1032: (238,238,238) #EEEEEE srgb(238,238,238)
          878: (239,239,239) #EFEFEF srgb(239,239,239)
         1083: (240,240,240) #F0F0F0 grey94
         1035: (241,241,241) #F1F1F1 srgb(241,241,241)
         1247: (242,242,242) #F2F2F2 grey95
         1610: (243,243,243) #F3F3F3 srgb(243,243,243)
         2084: (244,244,244) #F4F4F4 srgb(244,244,244)
         3473: (245,245,245) #F5F5F5 grey96
         6350: (246,246,246) #F6F6F6 srgb(246,246,246)
         9152: (247,247,247) #F7F7F7 grey97
        14755: (248,248,248) #F8F8F8 srgb(248,248,248)
        21183: (249,249,249) #F9F9F9 srgb(249,249,249)
        12507: (250,250,250) #FAFAFA grey98
         2516: (251,251,251) #FBFBFB srgb(251,251,251)
          305: (252,252,252) #FCFCFC grey99
           16: (253,253,253) #FDFDFD srgb(253,253,253)
            4: (254,254,254) #FEFEFE srgb(254,254,254)
     Rendering intent: Perceptual
     Gamma: 0.454545
     Chromaticity:
       red primary: (0.64,0.33)
       green primary: (0.3,0.6)
       blue primary: (0.15,0.06)
       white point: (0.3127,0.329)
     Background color: white
     Border color: srgb(223,223,223)
     Matte color: grey74
     Transparent color: black
     Interlace: None
     Intensity: Undefined
     Compose: Over
     Page geometry: 980x100+0+0
     Dispose: Undefined
     Iterations: 0
     Compression: JPEG
     Orientation: Undefined
     Properties:
       date:create: 2015-09-28T21:48:30+02:00
       date:modify: 2015-09-28T21:48:30+02:00
       jpeg:colorspace: 2
       jpeg:quality: 92
       jpeg:sampling-factor: 2x2,1x1,1x1
       signature: f718ab157fae4ff0395eaf07a0165897fd9de558eaed00586530690d39e5ed23
     Artifacts:
       filename: f2.jpg
       verbose: true
     Tainted: False
     Filesize: 4.32KB
     Number pixels: 98K
     Pixels per second: 0B
     User time: 0.000u
     Elapsed time: 0:01.000
     Version: ImageMagick 6.8.7-0 2013-10-28 Q16 http://www.imagemagick.org
  • ffmpeg run from shell runs properly, but does not when called from within .NET

    2 juillet 2013, par Bevin

    I'm attempting to use ffmpeg (compiled on Windows with Cygwin) in a C# program, by using the Process class to spawn an ffmpeg instance. However, I've hit a rather odd bug that doesn't make much sense.

    When I run ffmpeg directly from a shell (be it Cygwin's bash, PowerShell, cmd), ffmpeg can properly decode and reencode files without any issues :

    PS C:\audio> ffmpeg -i .\sound1.wav -acodec libvorbis -f ogg abc.ogg
    ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
     built on Apr  8 2013 15:10:40 with gcc 4.5.3 (GCC)
     configuration: --disable-encoder=vorbis --enable-libvorbis
     libavutil      52. 18.100 / 52. 18.100
     libavcodec     54. 92.100 / 54. 92.100
     libavformat    54. 63.104 / 54. 63.104
     libavdevice    54.  3.103 / 54.  3.103
     libavfilter     3. 42.103 /  3. 42.103
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
    [wav @ 0x800538a0] max_analyze_duration 5000000 reached at 5015510 microseconds
    Guessed Channel Layout for  Input Stream #0.0 : stereo
    Input #0, wav, from '.\sound1.wav':
     Metadata:
       encoder         : Lavf54.63.104
     Duration: 00:00:05.76, bitrate: 1411 kb/s
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    Output #0, ogg, to 'abc.ogg':
     Metadata:
       encoder         : Lavf54.63.104
       Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp
    Stream mapping:
     Stream #0:0 -> #0:0 (pcm_s16le -> libvorbis)
    Press [q] to stop, [?] for help
    size=      55kB time=00:00:05.74 bitrate=  78.5kbits/s
    video:0kB audio:51kB subtitle:0 global headers:4kB muxing overhead 0.817473%

    The file plays fine, and I can encode to WAV or any other format I like. However, when I call ffmpeg from C# with the following code :

    string tempfile = Path.GetTempFileName();
    FileStream tempfilestr = File.OpenWrite(tempfile);
    input.CopyTo(tempfilestr);

    ProcessStartInfo pstart = new ProcessStartInfo("ffmpeg", string.Format("-i \"{0}\" -v verbose -y -f wav -", tempfile));
    pstart.CreateNoWindow = true;
    pstart.ErrorDialog = false;
    pstart.RedirectStandardOutput = true;
    pstart.RedirectStandardError = true;
    pstart.UseShellExecute = false;


    Process proc = new Process();
    proc.StartInfo = pstart;
    proc.Start();
    StreamReader stdout = proc.StandardOutput;
    StreamReader stderr = proc.StandardError;

    outtempfilestr = File.OpenRead(outtempfile);
    MemoryStream output = new MemoryStream();

    stdout.BaseStream.CopyTo(output);

    try {
       proc.Kill();
    }
    catch(InvalidOperationException) { }
    catch(Win32Exception) { }

    File.Delete(tempfile);

    return output.ToArray();

    This randomly produces errors in the output :

    ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
     built on Apr  8 2013 15:10:40 with gcc 4.5.3 (GCC)
     configuration: --disable-encoder=vorbis --enable-libvorbis
     libavutil      52. 18.100 / 52. 18.100
     libavcodec     54. 92.100 / 54. 92.100
     libavformat    54. 63.104 / 54. 63.104
     libavdevice    54.  3.103 / 54.  3.103
     libavfilter     3. 42.103 /  3. 42.103
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
    [wav @ 0x80053860] parser not found for codec pcm_s16le, packets or times may be invalid.
       Last message repeated 1 times
    [wav @ 0x80053860] max_analyze_duration 5000000 reached at 5015510 microseconds
    Guessed Channel Layout for  Input Stream #0.0 : stereo
    Input #0, wav, from 'C:\Users\Bevin\AppData\Local\Temp\tmp1CCE.tmp':
     Duration: 00:00:05.20, bitrate: 1411 kb/s
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    [graph 0 input from stream 0:0 @ 0x8011f320] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
    Output #0, wav, to 'pipe:':
     Metadata:
       ISFT            : Lavf54.63.104
       Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
    Press [q] to stop, [?] for help
    Multiple frames in a packet from stream 0
    [pcm_s16le @ 0x8005c160] Invalid PCM packet, data has size 3 but at least a size of 4 was expected
    Error while decoding stream #0:0: Invalid data found when processing input
    No more output streams to write to, finishing.
    size=     896kB time=00:00:05.20 bitrate=1411.3kbits/s    
    video:0kB audio:896kB subtitle:0 global headers:0kB muxing overhead 0.008719%

    Note that these errors don't always occur. Sometimes they happen for certain files, sometimes they don't. I've tried various combinations of stream redirects and temp files, none of them work. I've also verified the integrity of the temp files, and it all checks out. I've even extracted the temp file before it was deleted, and decoded it in shell without a hitch.

    Any ideas ?

    Edit : I've tried running ffmpeg from a shell script that's run through C#. It gives the same issues. Compiling ffmpeg via MinGW gives the same issue as well.