Transcoded audio not delivered until fully transcoded

Issue #808 resolved
Will Lunniss created an issue

I and a number of ServiiGo users have noticed a problem whereby certain files when transcoded are not delived by the webserver until they have been fully transcoded. This seems to affect m4a files from iTunes, as well as certain flac files, possibly more. This problem is reproducible in MediaBrowser as well as ServiiGo. If you try to play back on of the files in MediaBrowesr, you will see ffmpeg transcoding the file and the file size increasing, and then once the file is fully transcoded, ffmpeg will stop and the webserver will return the file.

Attached is a sample flac file that a user sent in.

Comments (8)

  1. Petr Nejedly repo owner

    This seems to be caused by the cover image being transcoded as a part of the job (as implemented by #650). When I use -vn it works.

    d:\sample_media\music\test>d:\sample_media\video\ffmpeg.exe -i "01. Gil Shaham, Philharmonia Orchest
    ra (Sinopoli) - Bruch VC 1 in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca.flac" -c:a libmp
    3lame -f mp3 d:\out.mp3
    ffmpeg version 2.4.git Copyright (c) 2000-2014 the FFmpeg developers
      built on Nov 19 2014 22:12:09 with gcc 4.7.2 (GCC)
      configuration: --enable-static --disable-shared --disable-ffplay --disable-ffserver --enable-memal
    ign-hack --enable-libmp3lame --enable-libass --enable-librtmp --enable-fontconfig --enable-libfreety
    pe --enable-zlib --enable-libx264 --enable-libspeex --extra-libs='-lrtmp -lpolarssl -lws2_32 -lwinmm
     -lexpat -lfreetype -lfribidi -lz' --arch=x86 --enable-runtime-cpudetect --enable-pthreads --target-
    os=mingw32 --cross-prefix=i686-w64-mingw32- --enable-gpl --pkg-config=pkg-config
      libavutil      54. 14.100 / 54. 14.100
      libavcodec     56. 12.101 / 56. 12.101
      libavformat    56. 14.100 / 56. 14.100
      libavdevice    56.  3.100 / 56.  3.100
      libavfilter     5.  2.103 /  5.  2.103
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  1.100 /  1.  1.100
      libpostproc    53.  3.100 / 53.  3.100
    Input #0, flac, from '01. Gil Shaham, Philharmonia Orchestra (Sinopoli) - Bruch VC 1 in G minor Op.
    26 I. Vorspiel. Allegro moderato - attaca.flac':
      Metadata:
        ARTIST          : Gil Shaham, Philharmonia Orchestra (Sinopoli);Gil Shaham, Philharmonia Orchest
    ra (Sinopoli)
        encoder         : FLAC.EXE -6 -V -T "ARTIST=Gil Shaham, Philharmonia Orchestra (Sinopoli)" -T "T
    ITLE=Bruch VC 1 in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca" -T "ALBUM=Mendelssohn - Br
    uch - Violin Concertos" -T "DATE=" -T "TRACKNUMBER=01" -T "GENRE=Classical" -
        TITLE           : Bruch VC 1 in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca;Bruch VC 1
     in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca
        GENRE           : Classical;Classical
        TLEN            : 517706
        track           : 01
        encoded_by      : Exact Audio Copy   (Secure mode)
        ALBUM           : Mendelssohn - Bruch - Violin Concertos;Mendelssohn - Bruch - Violin Concertos
        disc            : 1
        TOTALDISCS      : 1
        TOTALTRACKS     : 6
      Duration: 00:08:37.71, start: 0.000000, bitrate: 635 kb/s
        Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
        Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 600x600 [SAR 1:1 DAR 1:1], 90k
     tbr, 90k tbn, 90k tbc
        Metadata:
          comment         : Cover (front)
    [swscaler @ 04270060] deprecated pixel format used, make sure you did set range correctly
    [mp3 @ 04309580] Frame rate very high for a muxer not efficiently supporting it.
    Please consider specifying a lower framerate, a different muxer or -vsync 2
    Output #0, mp3, to 'd:\out.mp3':
      Metadata:
        TPE1            : Gil Shaham, Philharmonia Orchestra (Sinopoli);Gil Shaham, Philharmonia Orchest
    ra (Sinopoli)
        TOTALTRACKS     : 6
        TIT2            : Bruch VC 1 in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca;Bruch VC 1
     in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca
        TCON            : Classical;Classical
        TLEN            : 517706
        TRCK            : 01
        TENC            : Exact Audio Copy   (Secure mode)
        TALB            : Mendelssohn - Bruch - Violin Concertos;Mendelssohn - Bruch - Violin Concertos
        TPOS            : 1
        TOTALDISCS      : 1
        TSSE            : Lavf56.14.100
        Stream #0:0: Video: png, rgb24, 600x600 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 90k fps, 90k tbn, 9
    0k tbc
        Metadata:
          comment         : Cover (front)
          encoder         : Lavc56.12.101 png
        Stream #0:1: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p
        Metadata:
          encoder         : Lavc56.12.101 libmp3lame
    Stream mapping:
      Stream #0:1 -> #0:0 (mjpeg (native) -> png (native))
      Stream #0:0 -> #0:1 (flac (native) -> mp3 (libmp3lame))
    Press [q] to stop, [?] for help
    frame=    1 fps=0.0 q=0.0 Lsize=    8596kB time=00:08:37.72 bitrate= 136.0kbits/s
    video:505kB audio:8090kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.008908
    %
    

    vs

    d:\sample_media\music\test>d:\sample_media\video\ffmpeg.exe -i "01. Gil Shaham, Philharmonia Orchest
    ra (Sinopoli) - Bruch VC 1 in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca.flac" -c:a libmp
    3lame -vn -f mp3 d:\out.mp3
    ffmpeg version 2.4.git Copyright (c) 2000-2014 the FFmpeg developers
      built on Nov 19 2014 22:12:09 with gcc 4.7.2 (GCC)
      configuration: --enable-static --disable-shared --disable-ffplay --disable-ffserver --enable-memal
    ign-hack --enable-libmp3lame --enable-libass --enable-librtmp --enable-fontconfig --enable-libfreety
    pe --enable-zlib --enable-libx264 --enable-libspeex --extra-libs='-lrtmp -lpolarssl -lws2_32 -lwinmm
     -lexpat -lfreetype -lfribidi -lz' --arch=x86 --enable-runtime-cpudetect --enable-pthreads --target-
    os=mingw32 --cross-prefix=i686-w64-mingw32- --enable-gpl --pkg-config=pkg-config
      libavutil      54. 14.100 / 54. 14.100
      libavcodec     56. 12.101 / 56. 12.101
      libavformat    56. 14.100 / 56. 14.100
      libavdevice    56.  3.100 / 56.  3.100
      libavfilter     5.  2.103 /  5.  2.103
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  1.100 /  1.  1.100
      libpostproc    53.  3.100 / 53.  3.100
    Input #0, flac, from '01. Gil Shaham, Philharmonia Orchestra (Sinopoli) - Bruch VC 1 in G minor Op.
    26 I. Vorspiel. Allegro moderato - attaca.flac':
      Metadata:
        ARTIST          : Gil Shaham, Philharmonia Orchestra (Sinopoli);Gil Shaham, Philharmonia Orchest
    ra (Sinopoli)
        encoder         : FLAC.EXE -6 -V -T "ARTIST=Gil Shaham, Philharmonia Orchestra (Sinopoli)" -T "T
    ITLE=Bruch VC 1 in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca" -T "ALBUM=Mendelssohn - Br
    uch - Violin Concertos" -T "DATE=" -T "TRACKNUMBER=01" -T "GENRE=Classical" -
        TITLE           : Bruch VC 1 in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca;Bruch VC 1
     in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca
        GENRE           : Classical;Classical
        TLEN            : 517706
        track           : 01
        encoded_by      : Exact Audio Copy   (Secure mode)
        ALBUM           : Mendelssohn - Bruch - Violin Concertos;Mendelssohn - Bruch - Violin Concertos
        disc            : 1
        TOTALDISCS      : 1
        TOTALTRACKS     : 6
      Duration: 00:08:37.71, start: 0.000000, bitrate: 635 kb/s
        Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
        Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 600x600 [SAR 1:1 DAR 1:1], 90k
     tbr, 90k tbn, 90k tbc
        Metadata:
          comment         : Cover (front)
    File 'd:\out.mp3' already exists. Overwrite ? [y/N] y
    Output #0, mp3, to 'd:\out.mp3':
      Metadata:
        TPE1            : Gil Shaham, Philharmonia Orchestra (Sinopoli);Gil Shaham, Philharmonia Orchest
    ra (Sinopoli)
        TOTALTRACKS     : 6
        TIT2            : Bruch VC 1 in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca;Bruch VC 1
     in G minor Op. 26 I. Vorspiel. Allegro moderato - attaca
        TCON            : Classical;Classical
        TLEN            : 517706
        TRCK            : 01
        TENC            : Exact Audio Copy   (Secure mode)
        TALB            : Mendelssohn - Bruch - Violin Concertos;Mendelssohn - Bruch - Violin Concertos
        TPOS            : 1
        TOTALDISCS      : 1
        TSSE            : Lavf56.14.100
        Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p
        Metadata:
          encoder         : Lavc56.12.101 libmp3lame
    Stream mapping:
      Stream #0:0 -> #0:0 (flac (native) -> mp3 (libmp3lame))
    Press [q] to stop, [?] for help
    size=    8091kB time=00:08:37.72 bitrate= 128.0kbits/s
    video:0kB audio:8090kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.009186%
    

    Note the FFmpeg progress line (eg frame 1)

  2. Former user Account Deleted

    Could the cover art be extracted and stored at the library scan stage, and "-vn" used on playback?

  3. Will Lunniss reporter

    @grolschie No the point is to ensure the transcoded file contains the original metadata and artwork embedded in it so that it can be extracted by clients. E.g. in ServiiGo I extract the high res artwork to display in the no playing screen/lockscreen. It also means the cached files can be used by third party players in offline mode.

    @zip So are you checking the frame progress before delivering the content, or is ffmpeg blocking? Anyway to work around it?

  4. Log in to comment