Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (48)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Submit enhancements and plugins

    13 avril 2011

    If you have developed a new extension to add one or more useful features to MediaSPIP, let us know and its integration into the core MedisSPIP functionality will be considered.
    You can use the development discussion list to request for help with creating a plugin. As MediaSPIP is based on SPIP - or you can use the SPIP discussion list SPIP-Zone.

Sur d’autres sites (3660)

  • IJG swings again, and misses

    1er février 2010, par Mans — Multimedia

    Earlier this month the IJG unleashed version 8 of its ubiquitous libjpeg library on the world. Eager to try out the “major breakthrough in image coding technology” promised in the README file accompanying v7, I downloaded the release. A glance at the README file suggests something major indeed is afoot :

    Version 8.0 is the first release of a new generation JPEG standard to overcome the limitations of the original JPEG specification.

    The text also hints at the existence of a document detailing these marvellous new features, and a Google search later a copy has found its way onto my monitor. As I read, however, my state of mind shifts from an initial excited curiosity, through bewilderment and disbelief, finally arriving at pure merriment.

    Already on the first page it becomes clear no new JPEG standard in fact exists. All we have is an unsolicited proposal sent to the ITU-T by members of the IJG. Realising that even the most brilliant of inventions must start off as mere proposals, I carry on reading. The summary informs me that I am about to witness the introduction of three extensions to the T.81 JPEG format :

    1. An alternative coefficient scan sequence for DCT coefficient serialization
    2. A SmartScale extension in the Start-Of-Scan (SOS) marker segment
    3. A Frame Offset definition in or in addition to the Start-Of-Frame (SOF) marker segment

    Together these three extensions will, it is promised, “bring DCT based JPEG back to the forefront of state-of-the-art image coding technologies.”

    Alternative scan

    The first of the proposed extensions introduces an alternative DCT coefficient scan sequence to be used in place of the zigzag scan employed in most block transform based codecs.

    Alternative scan sequence

    Alternative scan sequence

    The advantage of this scan would be that combined with the existing progressive mode, it simplifies decoding of an initial low-resolution image which is enhanced through subsequent passes. The author of the document calls this scheme “image-pyramid/hierarchical multi-resolution coding.” It is not immediately obvious to me how this constitutes even a small advance in image coding technology.

    At this point I am beginning to suspect that our friend from the IJG has been trapped in a half-world between interlaced GIF images transmitted down noisy phone lines and today’s inferno of SVC, MVC, and other buzzwords.

    (Not so) SmartScale

    Disguised behind this camel-cased moniker we encounter a method which, we are told, will provide better image quality at high compression ratios. The author has combined two well-known (to us) properties in a (to him) clever way.

    The first property concerns the perceived impact of different types of distortion in an image. When encoding with JPEG, as the quantiser is increased, the decoded image becomes ever more blocky. At a certain point, a better subjective visual quality can be achieved by down-sampling the image before encoding it, thus allowing a lower quantiser to be used. If the decoded image is scaled back up to the original size, the unpleasant, blocky appearance is replaced with a smooth blur.

    The second property belongs to the DCT where, as we all know, the top-left (DC) coefficient is the average of the entire block, its neighbours represent the lowest frequency components etc. A top-left-aligned subset of the coefficient block thus represents a low-resolution version of the full block in the spatial domain.

    In his flash of genius, our hero came up with the idea of using the DCT for down-scaling the image. Unfortunately, he appears to possess precious little knowledge of sampling theory and human visual perception. Any block-based resampling will inevitably produce sharp artefacts along the block edges. The human visual system is particularly sensitive to sharp edges, so this is one of the most unwanted types of distortion in an encoded image.

    Despite the obvious flaws in this approach, I decided to give it a try. After all, the software is already written, allowing downscaling by factors of 8/8..16.

    Using a 1280×720 test image, I encoded it with each of the nine scaling options, from unity to half size, each time adjusting the quality parameter for a final encoded file size of no more than 200000 bytes. The following table presents the encoded file size, the libjpeg quality parameter used, and the SSIM metric for each of the images.

    Scale Size Quality SSIM
    8/8 198462 59 0.940
    8/9 196337 70 0.936
    8/10 196133 79 0.934
    8/11 197179 84 0.927
    8/12 193872 89 0.915
    8/13 197153 92 0.914
    8/14 188334 94 0.899
    8/15 198911 96 0.886
    8/16 197190 97 0.869

    Although the smaller images allowed a higher quality setting to be used, the SSIM value drops significantly. Numbers may of course be misleading, but the images below speak for themselves. These are cut-outs from the full image, the original on the left, unscaled JPEG-compressed in the middle, and JPEG with 8/16 scaling to the right.

    Looking at these images, I do not need to hesitate before picking the JPEG variant I prefer.

    Frame offset

    The third and final extension proposed is quite simple and also quite pointless : a top-left cropping to be applied to the decoded image. The alleged utility of this feature would be to enable lossless cropping of a JPEG image. In a typical image workflow, however, JPEG is only used for the final published version, so the need for this feature appears quite far-fetched.

    The grand finale

    Throughout the text, the author makes references to “the fundamental DCT property for image representation.” In his own words :

    This property was found by the author during implementation of the new DCT scaling features and is after his belief one of the most important discoveries in digital image coding after releasing the JPEG standard in 1992.

    The secret is to be revealed in an annex to the main text. This annex quotes in full a post by the author to the comp.dsp Usenet group in a thread with the subject why DCT. Reading the entire thread proves quite amusing. A few excerpts follow.

    The actual reason is much simpler, and therefore apparently very difficult to recognize by complicated-thinking people.

    Here is the explanation :

    What are people doing when they have a bunch of images and want a quick preview ? They use thumbnails ! What are thumbnails ? Thumbnails are small downscaled versions of the original image ! If you want more details of the image, you can zoom in stepwise by enlarging (upscaling) the image.

    So with proper understanding of the fundamental DCT property, the MPEG folks could make their videos more scalable, but, as in the case of JPEG, they are unable to recognize this simple but basic property, unfortunately, and pursue rather inferior approaches in actual developments.

    These are just phrases, and they don’t explain anything. But this is typical for the current state in this field : The relevant people ignore and deny the true reasons, and thus they turn in a circle and no progress is being made.

    However, there are dark forces in action today which ignore and deny any fruitful advances in this field. That is the reason that we didn’t see any progress in JPEG for more than a decade, and as long as those forces dominate, we will see more confusion and less enlightenment. The truth is always simple, and the DCT *is* simple, but this fact is suppressed by established people who don’t want to lose their dubious position.

    I believe a trip to the Total Perspective Vortex may be in order. Perhaps his tin-foil hat will save him.

  • h264 extracting frames works only on certain operating system / ffmpeg version

    15 juin 2018, par J. S.

    I have received parsed h264 data from my phone, and I am trying to extract frames from the data.

    I used the following ffmpeg command lines :

    ffmpeg -i temp.h264 -ss 5 -pix_fmt yuv420p -vframes 1 foo.yuv

    ffmpeg -s 1280:720 -pix_fmt yuv420p -i foo.yuv output.jpg

    This results in the right output image on Ubuntu (KDE neon User Edition 5.12) with ffmpeg version 2.8.14.

    However, it does not work on macOS High Sierra (10.13.4) with ffmpeg version 4.0 and instead shows an output message :

    Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

    I am not sure whether this is a mere ffmpeg version-related issue or not because as an experiment, when I converted the h264 data into mp4 format and played it on macOS High Sierra, the video sometimes shows a sequence of black distorted image (screenshot), and other times, a normal video.

    If I play that same video on Ubuntu (KDE neon User Edition 5.12), the video plays perfectly.

    I don’t understand why this problem would occur, and whether this has to do with OS or ffmpeg library version.
    What would be some good ways to approach this problem ? Thanks.

    EDIT :

    Full log of first ffmpeg command line (ubuntu) :

    ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
     configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --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-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --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-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
     libavutil      54. 31.100 / 54. 31.100
     libavcodec     56. 60.100 / 56. 60.100
     libavformat    56. 40.101 / 56. 40.101
     libavdevice    56.  4.100 / 56.  4.100
     libavfilter     5. 40.101 /  5. 40.101
     libavresample   2.  1.  0 /  2.  1.  0
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  2.101 /  1.  2.101
     libpostproc    53.  3.100 / 53.  3.100
    [h264 @ 0x11ae2a0] error while decoding MB 54 2, bytestream -16
    [h264 @ 0x11ae2a0] top block unavailable for requested intra4x4 mode -1 at 2 9                                                                            
    [h264 @ 0x11ae2a0] error while decoding MB 2 9, bytestream 6908                                                                                            
    [h264 @ 0x11ae2a0] concealing 1275 DC, 1275 AC, 1275 MV errors in P frame
    [h264 @ 0x11ae2a0] top block unavailable for requested intra4x4 mode -1 at 27 0
    [h264 @ 0x11ae2a0] error while decoding MB 27 0, bytestream 5564                                                                                          
    [h264 @ 0x11ae2a0] deblocking filter parameters 7 13 out of range                                                                                          
    [h264 @ 0x11ae2a0] decode_slice_header error                                                                                                              
    [h264 @ 0x11ae2a0] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x11ae2a0] deblocking filter parameters 7 -14 out of range
    [h264 @ 0x11ae2a0] decode_slice_header error                                                                                                              
    [h264 @ 0x11ae2a0] concealing 1387 DC, 1387 AC, 1387 MV errors in P frame
    [h264 @ 0x11ae2a0] deblocking filter parameters -7 0 out of range
    [h264 @ 0x11ae2a0] decode_slice_header error                                                                                                              
    [h264 @ 0x11ae2a0] concealing 1413 DC, 1413 AC, 1413 MV errors in P frame
    [h264 @ 0x11ae2a0] top block unavailable for requested intra4x4 mode -1 at 9 0
    [h264 @ 0x11ae2a0] error while decoding MB 9 0, bytestream 6647                                                                                            
    [h264 @ 0x11ae2a0] concealing 1186 DC, 1186 AC, 1186 MV errors in P frame
    [h264 @ 0x11ae2a0] top block unavailable for requested intra mode at 16 9
    [h264 @ 0x11ae2a0] error while decoding MB 16 9, bytestream 6182                                                                                          
    [h264 @ 0x11ae2a0] top block unavailable for requested intra4x4 mode -1 at 6 18                                                                            
    [h264 @ 0x11ae2a0] error while decoding MB 6 18, bytestream 7042                                                                                          
    [h264 @ 0x11ae2a0] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x11ad340] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Input #0, h264, from 'temp.h264':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: h264 (High), yuvj420p(pc), 1280x720, 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc
    [swscaler @ 0x1207dc0] deprecated pixel format used, make sure you did set range correctly
    Output #0, rawvideo, to 'foo.yuv':
     Metadata:
       encoder         : Lavf56.40.101
       Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
       Metadata:
         encoder         : Lavc56.60.100 rawvideo
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
    Press [q] to stop, [?] for help
    [h264 @ 0x11f98a0] error while decoding MB 54 2, bytestream -16
    [h264 @ 0x11f98a0] top block unavailable for requested intra4x4 mode -1 at 2 9                                                                            
    [h264 @ 0x11f98a0] error while decoding MB 2 9, bytestream 6908                                                                                            
    [h264 @ 0x11f98a0] concealing 1275 DC, 1275 AC, 1275 MV errors in P frame
    [h264 @ 0x12758e0] top block unavailable for requested intra4x4 mode -1 at 27 0
    [h264 @ 0x12758e0] error while decoding MB 27 0, bytestream 5564                                                                                          
    [h264 @ 0x12758e0] deblocking filter parameters 7 13 out of range                                                                                          
    [h264 @ 0x12758e0] decode_slice_header error                                                                                                              
    [h264 @ 0x12758e0] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x11ffcc0] deblocking filter parameters 7 -14 out of range
    [h264 @ 0x11ffcc0] decode_slice_header error                                                                                                              
    [h264 @ 0x11ffcc0] concealing 1387 DC, 1387 AC, 1387 MV errors in P frame
    [h264 @ 0x11f98a0] deblocking filter parameters -7 0 out of range
    [h264 @ 0x11f98a0] decode_slice_header error                                                                                                              
    [h264 @ 0x11f98a0] concealing 1413 DC, 1413 AC, 1413 MV errors in P frame
    [h264 @ 0x12758e0] top block unavailable for requested intra4x4 mode -1 at 9 0
    [h264 @ 0x12758e0] error while decoding MB 9 0, bytestream 6647                                                                                            
    [h264 @ 0x12758e0] concealing 1186 DC, 1186 AC, 1186 MV errors in P frame
    [h264 @ 0x11ffcc0] top block unavailable for requested intra mode at 16 9
    [h264 @ 0x11ffcc0] error while decoding MB 16 9, bytestream 6182                                                                                          
    [h264 @ 0x11ffcc0] top block unavailable for requested intra4x4 mode -1 at 6 18                                                                            
    [h264 @ 0x11ffcc0] error while decoding MB 6 18, bytestream 7042                                                                                          
    [h264 @ 0x11ffcc0] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x11f98a0] top block unavailable for requested intra4x4 mode -1 at 12 9
    [h264 @ 0x11f98a0] error while decoding MB 12 9, bytestream 6863                                                                                          
    [h264 @ 0x11f98a0] concealing 1342 DC, 1342 AC, 1342 MV errors in P frame
    [h264 @ 0x12758e0] top block unavailable for requested intra mode at 29 18
    [h264 @ 0x12758e0] error while decoding MB 29 18, bytestream 6612                                                                                          
    [h264 @ 0x12758e0] concealing 1405 DC, 1405 AC, 1405 MV errors in P frame
    [h264 @ 0x11ffcc0] top block unavailable for requested intra mode at 25 9
    [h264 @ 0x11ffcc0] error while decoding MB 25 9, bytestream 6051                                                                                          
    [h264 @ 0x11ffcc0] top block unavailable for requested intra4x4 mode -1 at 70 18                                                                          
    [h264 @ 0x11ffcc0] error while decoding MB 70 18, bytestream 5089                                                                                          
    [h264 @ 0x11ffcc0] concealing 1419 DC, 1419 AC, 1419 MV errors in P frame
    [h264 @ 0x11f98a0] top block unavailable for requested intra mode at 14 9
    [h264 @ 0x11f98a0] error while decoding MB 14 9, bytestream 6071
    [h264 @ 0x11f98a0] deblocking filter parameters -9 0 out of range
    [h264 @ 0x11f98a0] decode_slice_header error
    [h264 @ 0x11f98a0] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x12758e0] top block unavailable for requested intra4x4 mode -1 at 54 9
    [h264 @ 0x12758e0] error while decoding MB 54 9, bytestream 4423
    [h264 @ 0x12758e0] concealing 1256 DC, 1256 AC, 1256 MV errors in P frame
    [h264 @ 0x11ffcc0] top block unavailable for requested intra4x4 mode -1 at 22 9
    [h264 @ 0x11ffcc0] error while decoding MB 22 9, bytestream 5861
    [h264 @ 0x11ffcc0] concealing 1335 DC, 1335 AC, 1335 MV errors in P frame
    [h264 @ 0x11f98a0] deblocking filter parameters 7 -4 out of range
    [h264 @ 0x11f98a0] decode_slice_header error
    [h264 @ 0x11f98a0] concealing 1430 DC, 1430 AC, 1430 MV errors in P frame
    [h264 @ 0x12758e0] concealing 1319 DC, 1319 AC, 1319 MV errors in P frame
    [h264 @ 0x11ffcc0] top block unavailable for requested intra4x4 mode -1 at 16 9
    [h264 @ 0x11ffcc0] error while decoding MB 16 9, bytestream 6217
    [h264 @ 0x11ffcc0] concealing 1416 DC, 1416 AC, 1416 MV errors in P frame
    [h264 @ 0x11f98a0] top block unavailable for requested intra4x4 mode -1 at 12 0
    [h264 @ 0x11f98a0] error while decoding MB 12 0, bytestream 6854
    [h264 @ 0x11f98a0] top block unavailable for requested intra4x4 mode -1 at 2 9
    [h264 @ 0x11f98a0] error while decoding MB 2 9, bytestream 7093
    [h264 @ 0x11f98a0] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x12758e0] top block unavailable for requested intra4x4 mode -1 at 59 0
    [h264 @ 0x12758e0] error while decoding MB 59 0, bytestream 4955
    [h264 @ 0x12758e0] deblocking filter parameters 7 15 out of range
    [h264 @ 0x12758e0] decode_slice_header error
    [h264 @ 0x12758e0] concealing 1430 DC, 1430 AC, 1430 MV errors in P frame
    [h264 @ 0x11ffcc0] top block unavailable for requested intra4x4 mode -1 at 34 0
    [h264 @ 0x11ffcc0] error while decoding MB 34 0, bytestream 5338
    [h264 @ 0x11ffcc0] deblocking filter parameters 7 13 out of range
    [h264 @ 0x11ffcc0] decode_slice_header error
    [h264 @ 0x11ffcc0] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x11ffcc0] Reinit context to 1280x720, pix_fmt: yuv420p
    [h264 @ 0x11f98a0] concealing 1344 DC, 1344 AC, 1344 MV errors in P frame
    [h264 @ 0x12758e0] top block unavailable for requested intra4x4 mode -1 at 49 9
    [h264 @ 0x12758e0] error while decoding MB 49 9, bytestream 4993
    [h264 @ 0x12758e0] concealing 1228 DC, 1228 AC, 1228 MV errors in P frame
    Input stream #0:0 frame changed from size:1280x720 fmt:yuvj420p to size:1280x720 fmt:yuv420p
    frame=    1 fps=0.6 q=-0.0 Lsize=    1350kB time=00:00:04.93 bitrate=2239.5kbits/s    
    video:1350kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%

    Full log of first ffmpeg command line (macOS) :

    ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
     built with Apple LLVM version 9.1.0 (clang-902.0.39.1)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
     libavutil      56. 14.100 / 56. 14.100
     libavcodec     58. 18.100 / 58. 18.100
     libavformat    58. 12.100 / 58. 12.100
     libavdevice    58.  3.100 / 58.  3.100
     libavfilter     7. 16.100 /  7. 16.100
     libavresample   4.  0.  0 /  4.  0.  0
     libswscale      5.  1.100 /  5.  1.100
     libswresample   3.  1.100 /  3.  1.100
     libpostproc    55.  1.100 / 55.  1.100
    [h264 @ 0x7fcb3880b600] error while decoding MB 54 2, bytestream -14
    [h264 @ 0x7fcb3880b600] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb3880b600] error while decoding MB 2 9, bytestream 6908
    [h264 @ 0x7fcb3880b600] concealing 1275 DC, 1275 AC, 1275 MV errors in P frame
    [h264 @ 0x7fcb3880b600] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb3880b600] error while decoding MB 27 0, bytestream 5564
    [h264 @ 0x7fcb3880b600] deblocking filter parameters 7 13 out of range
    [h264 @ 0x7fcb3880b600] decode_slice_header error
    [h264 @ 0x7fcb3880b600] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x7fcb3880b600] deblocking filter parameters 7 -14 out of range
    [h264 @ 0x7fcb3880b600] decode_slice_header error
    [h264 @ 0x7fcb3880b600] concealing 1387 DC, 1387 AC, 1387 MV errors in P frame
    [h264 @ 0x7fcb3880b600] deblocking filter parameters -7 0 out of range
    [h264 @ 0x7fcb3880b600] decode_slice_header error
    [h264 @ 0x7fcb3880b600] concealing 1413 DC, 1413 AC, 1413 MV errors in P frame
    [h264 @ 0x7fcb3880b600] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb3880b600] error while decoding MB 9 0, bytestream 6647
    [h264 @ 0x7fcb3880b600] concealing 1186 DC, 1186 AC, 1186 MV errors in P frame
    [h264 @ 0x7fcb3880b600] top block unavailable for requested intra mode
    [h264 @ 0x7fcb3880b600] error while decoding MB 16 9, bytestream 6183
    [h264 @ 0x7fcb3880b600] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb3880b600] error while decoding MB 6 18, bytestream 7043
    [h264 @ 0x7fcb3880b600] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x7fcb39000400] Stream #0: not enough frames to estimate rate; consider increasing probesize
    Input #0, h264, from 'temp.h264':
     Duration: N/A, bitrate: N/A
       Stream #0:0: Video: h264 (High), yuvj420p(pc, progressive), 1280x720, 29.97 fps, 29.97 tbr, 1200k tbn, 59.94 tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
    Press [q] to stop, [?] for help
    [h264 @ 0x7fcb38003800] error while decoding MB 54 2, bytestream -14
    [h264 @ 0x7fcb38003800] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003800] error while decoding MB 2 9, bytestream 6908
    [h264 @ 0x7fcb38003800] concealing 1275 DC, 1275 AC, 1275 MV errors in P frame
    [h264 @ 0x7fcb38003e00] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003e00] error while decoding MB 27 0, bytestream 5564
    [h264 @ 0x7fcb38003e00] deblocking filter parameters 7 13 out of range
    [h264 @ 0x7fcb38003e00] decode_slice_header error
    [h264 @ 0x7fcb38003e00] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [swscaler @ 0x7fcb3817aa00] deprecated pixel format used, make sure you did set range correctly
    [h264 @ 0x7fcb3809c000] deblocking filter parameters 7 -14 out of range
    [h264 @ 0x7fcb3809c000] decode_slice_header error
    [h264 @ 0x7fcb3809c000] concealing 1387 DC, 1387 AC, 1387 MV errors in P frame
    Output #0, rawvideo, to 'foo.yuv':
     Metadata:
       encoder         : Lavf58.12.100
       Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, q=2-31, 331444 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
       Metadata:
         encoder         : Lavc58.18.100 rawvideo
    [h264 @ 0x7fcb3809c600] deblocking filter parameters -7 0 out of range
    [h264 @ 0x7fcb3809c600] decode_slice_header error
    [h264 @ 0x7fcb3809c600] concealing 1413 DC, 1413 AC, 1413 MV errors in P frame
    [h264 @ 0x7fcb38003200] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003200] error while decoding MB 9 0, bytestream 6647
    [h264 @ 0x7fcb38003200] concealing 1186 DC, 1186 AC, 1186 MV errors in P frame
    [h264 @ 0x7fcb38003800] top block unavailable for requested intra mode
    [h264 @ 0x7fcb38003800] error while decoding MB 16 9, bytestream 6183
    [h264 @ 0x7fcb38003800] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003800] error while decoding MB 6 18, bytestream 7043
    [h264 @ 0x7fcb38003800] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x7fcb38003e00] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003e00] error while decoding MB 12 9, bytestream 6862
    [h264 @ 0x7fcb38003e00] concealing 1342 DC, 1342 AC, 1342 MV errors in P frame
    [h264 @ 0x7fcb3809c000] top block unavailable for requested intra mode
    [h264 @ 0x7fcb3809c000] error while decoding MB 29 18, bytestream 6612
    [h264 @ 0x7fcb3809c000] concealing 1405 DC, 1405 AC, 1405 MV errors in P frame
    [h264 @ 0x7fcb3809c600] top block unavailable for requested intra mode
    [h264 @ 0x7fcb3809c600] error while decoding MB 25 9, bytestream 6050
    [h264 @ 0x7fcb3809c600] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb3809c600] error while decoding MB 70 18, bytestream 5089
    [h264 @ 0x7fcb3809c600] concealing 1419 DC, 1419 AC, 1419 MV errors in P frame
    [h264 @ 0x7fcb38003200] top block unavailable for requested intra mode
    [h264 @ 0x7fcb38003200] error while decoding MB 14 9, bytestream 6071
    [h264 @ 0x7fcb38003200] deblocking filter parameters -9 0 out of range
    [h264 @ 0x7fcb38003200] decode_slice_header error
    [h264 @ 0x7fcb38003200] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x7fcb38003800] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003800] error while decoding MB 54 9, bytestream 4423
    [h264 @ 0x7fcb38003800] concealing 1256 DC, 1256 AC, 1256 MV errors in P frame
    [h264 @ 0x7fcb38003e00] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003e00] error while decoding MB 22 9, bytestream 5862
    [h264 @ 0x7fcb38003e00] concealing 1335 DC, 1335 AC, 1335 MV errors in P frame
    [h264 @ 0x7fcb3809c000] deblocking filter parameters 7 -4 out of range
    [h264 @ 0x7fcb3809c000] decode_slice_header error
    [h264 @ 0x7fcb3809c000] concealing 1430 DC, 1430 AC, 1430 MV errors in P frame
    [h264 @ 0x7fcb3809c600] concealing 1319 DC, 1319 AC, 1319 MV errors in P frame
    [h264 @ 0x7fcb38003200] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003200] error while decoding MB 16 9, bytestream 6217
    [h264 @ 0x7fcb38003200] concealing 1416 DC, 1416 AC, 1416 MV errors in P frame
    [h264 @ 0x7fcb38003800] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003800] error while decoding MB 12 0, bytestream 6854
    [h264 @ 0x7fcb38003800] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003800] error while decoding MB 2 9, bytestream 7093
    [h264 @ 0x7fcb38003800] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x7fcb38003e00] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003e00] error while decoding MB 59 0, bytestream 4955
    [h264 @ 0x7fcb38003e00] deblocking filter parameters 7 15 out of range
    [h264 @ 0x7fcb38003e00] decode_slice_header error
    [h264 @ 0x7fcb38003e00] concealing 1430 DC, 1430 AC, 1430 MV errors in P frame
    [h264 @ 0x7fcb3809c000] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb3809c000] error while decoding MB 34 0, bytestream 5338
    [h264 @ 0x7fcb3809c000] deblocking filter parameters 7 13 out of range
    [h264 @ 0x7fcb3809c000] decode_slice_header error
    [h264 @ 0x7fcb3809c000] concealing 1440 DC, 1440 AC, 1440 MV errors in P frame
    [h264 @ 0x7fcb3809c600] concealing 1344 DC, 1344 AC, 1344 MV errors in P frame
    [h264 @ 0x7fcb38003200] top block unavailable for requested intra mode -1
    [h264 @ 0x7fcb38003200] error while decoding MB 49 9, bytestream 4992
    [h264 @ 0x7fcb38003200] concealing 1228 DC, 1228 AC, 1228 MV errors in P frame
    frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
  • Android FFmpegPlayer Streaming Service onClick notification

    8 octobre 2013, par agony

    I have a MainActivity class that displays the list of streams available for my project and the StreamingActivity class where the streaming is done.

    If the user selected an item from the list it will start the StreamingActivity and start playing the stream.
    I'm having trouble to continue streaming music when the user pressed the notification and returning it to the StreamingActivity class if the user pressed or clicked the home menu or when the app goes to onDestroy().

    I'm using FFmpegPlayer for my project 'coz it requires to play mms :// live streams for local FM station.

    Here's my code :

    public class StreamingActivity extends BaseActivity  implements ActionBar.TabListener,
    PlayerControlListener, IMediaPlayerServiceClient {


    private StatefulMediaPlayer mMediaPlayer;
    private FFmpegService mService;
    private boolean mBound;

    public static final String TAG = "StationActivity";

    private static Bundle mSavedInstanceState;

    private static PlayerFragment mPlayerFragment;
    private static DJListFragment mDjListFragment;

    private SectionsPagerAdapter mSectionsPagerAdapter;
    private ViewPager mViewPager;

    private String stream = "";
    private String fhz = "";
    private String page = "0";

    private Dialog shareDialog;
       private ProgressDialog dialog;

    private boolean isStreaming;


    /*************************************************************************************************************/

    @Override
    public void onCreate(Bundle savedInstanceState){
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_station);

       Bundle bundle = getIntent().getExtras();
       if(bundle !=null){
           fhz = bundle.getString("fhz");
           stream = bundle.getString("stream");
       }

       Log.d(TAG, "page: " + page + " fhz: " + fhz + " stream: " + stream + " isStreaming: " + isStreaming);

       getSupportActionBar().setTitle("Radio \n" + fhz);
       getSupportActionBar().setDisplayHomeAsUpEnabled(true);
       getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

       mPlayerFragment = (PlayerFragment) Fragment.instantiate(this, PlayerFragment.class.getName(), null);
       mDjListFragment = (DJListFragment) Fragment.instantiate(this, DJListFragment.class.getName(), null);

       mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

       mViewPager = (ViewPager) findViewById(R.id.pager);
       mViewPager.setAdapter(mSectionsPagerAdapter);
       mViewPager.setCurrentItem(Integer.parseInt(page));

       mSavedInstanceState = savedInstanceState;

       Tab playingTab = getSupportActionBar().newTab();
       playingTab.setText(getString(R.string.playing_label));
       playingTab.setTabListener(this);

       Tab djTab = getSupportActionBar().newTab();
       djTab.setText(getString(R.string.dj_label));
       djTab.setTabListener(this);

       getSupportActionBar().addTab(playingTab);
       getSupportActionBar().addTab(djTab);

       // When swiping between different sections, select the corresponding
       // tab. We can also use ActionBar.Tab#select() to do this if we have
       // a reference to the Tab.
       mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
           @Override
           public void onPageSelected(int position) {
               StationActivity.this.getSupportActionBar().setSelectedNavigationItem(position);
           }
       });

       if (mSavedInstanceState != null) {
           getSupportActionBar().setSelectedNavigationItem(mSavedInstanceState.getInt("tab", 0));
       }

       dialog = new ProgressDialog(this);

       bindToService();

       UriBean.getInstance().setStream(stream);
       Log.d(TAG ,"stream: " + UriBean.getInstance().getStream());

    }

    /********************************************************************************************************/

    public class SectionsPagerAdapter extends FragmentPagerAdapter {
       public SectionsPagerAdapter(FragmentManager fm) {
           super(fm);
       }

       @Override
       public Fragment getItem(int position) {
           if (position == 0) {
               return mPlayerFragment;
           } else {
               return mDjListFragment;
           }
       }

       @Override
       public int getCount() {
           return 2;
       }
    }

    @Override
    public void onTabSelected(Tab tab, FragmentTransaction ft) {
       // When the given tab is selected, switch to the corresponding page in the ViewPager.
       mViewPager.setCurrentItem(tab.getPosition());
    }

    @Override
    public void onTabUnselected(Tab tab, FragmentTransaction ft) { }

    @Override
    public void onTabReselected(Tab tab, FragmentTransaction ft) { }

    /********************************************************************************************************/

    public void showLoadingDialog() {
       dialog.setMessage("Buffering...");
       dialog.show();
    }

    public void dismissLoadingDialog() {
       dialog.dismiss();
    }

    /********************************************************************************************************/

    /**
    * Binds to the instance of MediaPlayerService. If no instance of MediaPlayerService exists, it first starts
    * a new instance of the service.
    */
    public void bindToService() {
       Intent intent = new Intent(this, FFmpegService.class);

       if (Util.isFFmpegServiceRunning(getApplicationContext())){
           // Bind to Service
           Log.i(TAG, "bindService");
           bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
       } else {
           //start service and bind to it
           Log.i(TAG, "startService & bindService");
           startService(intent);
           bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
       }
    }


    /**
    * Defines callbacks for service binding, passed to bindService()
    */
    private ServiceConnection mConnection = new ServiceConnection() {
       @Override
       public void onServiceConnected(ComponentName className, IBinder serviceBinder) {
           Log.d(TAG,"service connected");

           //bound with Service. get Service instance
           MediaPlayerBinder binder = (FFmpegService.MediaPlayerBinder) serviceBinder;
           mService = binder.getService();

           //send this instance to the service, so it can make callbacks on this instance as a client
           mService.setClient(StationActivity.this);
           mBound = true;

           Log.d(TAG, "isPlaying === SERVICE: " + mService.isPlaying());

           //if

           startStreaming();
       }

       @Override
       public void onServiceDisconnected(ComponentName arg0) {
           mBound = false;
           mService = null;
       }
    };

    /********************************************************************************************************/

    @Override
    public void onPlayerPlayStop() {
       Log.d(TAG, "onPlayerPlayStop");

       Log.v(TAG, "isStreaming: " + isStreaming);
       Log.v(TAG, "mBound:  " + mBound);

       if (mBound) {
           Log.d(TAG, "bound.............");
           mMediaPlayer = mService.getMediaPlayer();
           //pressed pause ->pause
           if (!PlayerFragment.play.isChecked()) {
               if (mMediaPlayer.isStarted()) {
                   Log.d(TAG, "pause");
                   mService.pauseMediaPlayer();
               }
           } else { //pressed play
               // STOPPED, CREATED, EMPTY, -> initialize
               if (mMediaPlayer.isStopped() || mMediaPlayer.isCreated() || mMediaPlayer.isEmpty()) {
                   startStreaming();
               } else if (mMediaPlayer.isPrepared() || mMediaPlayer.isPaused()) { //prepared, paused -> resume play
                   Log.d(TAG, "start");
                   mService.startMediaPlayer();
               }
           }

           Log.d(TAG, "isPlaying === SERVICE: " + mService.isPlaying());
       }
    }

    /********************************************************************************************************/

    @Override
    public void onDownload() {
       Toast.makeText(this, "Not yet available...", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onComment() {
       FragmentManager fm = getSupportFragmentManager();
       DialogFragment newFragment = MyAlertDialogFragment.newInstance();
       newFragment.show(fm, "comment_dialog");
    }

    @Override
    public void onShare() {
       showShareDialog();
    }

    /********************************************************************************************************/

    private void startStreaming() {
       Log.d(TAG, "@startLoading");
       boolean isNetworkFound = Util.checkConnectivity(getApplicationContext());
       if(isNetworkFound) {
           Log.d(TAG, "network found");
           mService.initializePlayer(stream);
           isStreaming = true;
       } else {
           Toast.makeText(getApplicationContext(), "No internet connection found...", Toast.LENGTH_SHORT).show();
       }

       Log.d(TAG, "isStreaming: " + isStreaming);
       Log.d(TAG, "isPlaying === SERVICE: " + mService.isPlaying());
    }

    @Override
    public void onInitializePlayerStart() {
       showLoadingDialog();
    }

    @Override
    public void onInitializePlayerSuccess() {
       dismissLoadingDialog();
       PlayerFragment.play.setChecked(true);


       Log.d(TAG, "isPlaying === SERVICE: " + mService.isPlaying());
    }

    @Override
    public void onError() {
       Toast.makeText(getApplicationContext(), "Not connected to the server...", Toast.LENGTH_SHORT).show();
    }

       @Override
    public void onDestroy() {
       Log.d(TAG, "onDestroy");
       super.onDestroy();
       uiHelper.onDestroy();

       Log.d(TAG, "isPlaying === SERVICE: " + mService.isPlaying());
       if (mBound) {
           mService.unRegister();
           unbindService(mConnection);
           mBound = false;
       }

       Log.d(TAG, "service: " + Util.isFFmpegServiceRunning(getApplicationContext()));
    }

    @Override
    public void onStop(){
       Log.d(TAG, "onStop");
       super.onStop();
    }

    /*******************************************************************************************************/

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
       int itemId = item.getItemId();
       switch (itemId){
       case android.R.id.home:
           onBackPressed();
           break;
       default:
           break;
       }    
       return true;
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
       Log.d(TAG, "@onKeyDown");
       if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0){
           //this.moveTaskToBack(true);
           onBackPressed();
           return true;
       }
       return super.onKeyDown(keyCode, event);
    }
    }






    public class FFmpegService  extends Service implements IMediaPlayerThreadClient {

    private FFmpegPlayerThread mMediaPlayerThread       = new FFmpegPlayerThread(this);
    private final Binder mBinder                        = new MediaPlayerBinder();
    private IMediaPlayerServiceClient mClient;
    //private StreamStation mCurrentStation;

    private boolean mIsSupposedToBePlaying = false;

    private boolean isPausedInCall = false;
    private PhoneStateListener phoneStateListener;
    private TelephonyManager telephonyManager;

    @Override
    public void onCreate(){
       mMediaPlayerThread.start();
    }

    /**
    * A class for clients binding to this service. The client will be passed an object of this class
    * via its onServiceConnected(ComponentName, IBinder) callback.
    */
    public class MediaPlayerBinder extends Binder {
       /**
        * Returns the instance of this service for a client to make method calls on it.
        * @return the instance of this service.
        */
       public FFmpegService getService() {
           return FFmpegService.this;
       }
    }

    /**
    * Returns the contained StatefulMediaPlayer
    * @return
    */
    public StatefulMediaPlayer getMediaPlayer() {
       return mMediaPlayerThread.getMediaPlayer();
    }

    public boolean isPlaying() {
       return mIsSupposedToBePlaying;
    }

    @Override
    public IBinder onBind(Intent arg0) {
       return mBinder;
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {

       telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
       phoneStateListener = new PhoneStateListener() {
           @Override
           public void onCallStateChanged(int state, String incomingNumber) {
               // String stateString = "N/A";
               Log.v("FFmpegService", "Starting CallStateChange");
               switch (state) {
               case TelephonyManager.CALL_STATE_OFFHOOK:
               case TelephonyManager.CALL_STATE_RINGING:
                   if (mMediaPlayerThread != null) {
                       pauseMediaPlayer();
                       isPausedInCall = true;
                   }
                   break;
               case TelephonyManager.CALL_STATE_IDLE:
                   // Phone idle. Start playing.
                   if (mMediaPlayerThread != null) {
                       if (isPausedInCall) {
                           isPausedInCall = false;
                           startMediaPlayer();
                       }
                   }
                   break;
               }
           }
       };

       // Register the listener with the telephony manager
       telephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);

       return START_STICKY;
    }

    /**
    * Sets the client using this service.
    * @param client The client of this service, which implements the IMediaPlayerServiceClient interface
    */
    public void setClient(IMediaPlayerServiceClient client) {
       this.mClient = client;
    }


    public void initializePlayer(final String station) {
       //mCurrentStation = station;
       mMediaPlayerThread.initializePlayer(station);
    }

    public void startMediaPlayer() {

       Intent notificationIntent = new Intent(getApplicationContext(), StreamingActivity.class);
       //notificationIntent.putExtra("page", "0");
       //notificationIntent.putExtra("isPlaying", isPlaying());
       notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
       PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0 , notificationIntent , PendingIntent.FLAG_UPDATE_CURRENT);

       NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
               .setSmallIcon(R.drawable.ic_launcher)
               .setContentTitle("You are listening to Radio...")
               .setContentText("test!!!")
               .setContentIntent(contentIntent);

       startForeground(1, mBuilder.build());

       NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
       notificationManager.notify(1, mBuilder.build());

       mIsSupposedToBePlaying = true;
       mMediaPlayerThread.startMediaPlayer();
    }

    public void dismissNotification(Context context) {
       String ns = Context.NOTIFICATION_SERVICE;
       NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
       mNotificationManager.cancel(1);
    }

    /**
    * Pauses playback
    */
    public void pauseMediaPlayer() {
       Log.d("MediaPlayerService","pauseMediaPlayer() called");
       mMediaPlayerThread.pauseMediaPlayer();
       stopForeground(true);
       mIsSupposedToBePlaying = false;
       dismissNotification(this);
    }
    /**
    * Stops playback
    */
    public void stopMediaPlayer() {
       stopForeground(true);
       mMediaPlayerThread.stopMediaPlayer();

       mIsSupposedToBePlaying = false;
       dismissNotification(this);
    }

    public void resetMediaPlayer() {
       mIsSupposedToBePlaying = false;
       stopForeground(true);
       mMediaPlayerThread.resetMediaPlayer();
       dismissNotification(this);
    }

    @Override
    public void onError() {
       mIsSupposedToBePlaying = false;
       mClient.onError();
       dismissNotification(this);
    }

    @Override
    public void onInitializePlayerStart() {
       mClient.onInitializePlayerStart();
    }

    @Override
    public void onInitializePlayerSuccess() {
       startMediaPlayer();
       mClient.onInitializePlayerSuccess();
       mIsSupposedToBePlaying = true;
    }

    public void unRegister() {
       this.mClient = null;
       mIsSupposedToBePlaying = false;
       dismissNotification(this);
    }

    }

    Hoping someone can help me here...