[FFmpeg-user] Copying streams from partial FLVs?

Chris Pennello chris at redux.com
Wed Mar 19 22:12:22 CET 2014


I'm trying to copy the video and audio streams from a partial FLV, and it's able to copy only the audio. I'd like to figure out how to get the video out as well.

This partial FLV is one that I've downloaded from a server that supports "pseudo-streaming".  Such a file can be played in a Flash player.  For example, when the user seeks ahead of buffered data, the Flash program consults a table of the keyframe time indexes and corresponding byte offsets, originally read from the video's metadata, and provides a query-string parameter to a "pseudo-streaming"-compatible web server containing the desired byte offset.  The web server then supplies not only the video data starting at that byte offset, but it also prepends a 13-byte header which seems to identify the data as an FLV video.

I have parsed and consulted this list of keyframe time indexes and corresponding byte offsets in order to obtain the FLV I'm feeding into FFmpeg.

How can I get FFmpeg to be able to read the video out of this partial FLV?  Find several invocations below.

Much appreciated,
Chris


% ffprobe tmp/rangetest2.flv                                               
ffprobe version 2.0.1-tessus Copyright (c) 2007-2013 the FFmpeg developers
  built on Aug 10 2013 21:25:56 with llvm-gcc 4.2.1 (LLVM build 2336.1.00)
  configuration: --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-fontconfig --enable-libfreetype --enable-libass --enable-libbluray --enable-filters --enable-runtime-cpudetect
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[h264 @ 0x102014600] no frame!
    Last message repeated 133 times
[h264 @ 0x102014600] non-existing PPS 1 referenced
[h264 @ 0x102014600] decode_slice_header error
[h264 @ 0x102014600] no frame!
    Last message repeated 16 times
[h264 @ 0x102014600] non-existing SPS 0 referenced in buffering period
[h264 @ 0x102014600] no frame!
[flv @ 0x10200c000] decoding for stream 0 failed
[flv @ 0x10200c000] Could not find codec parameters for stream 0 (Video: h264): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, flv, from 'tmp/rangetest2.flv':
  Duration: 00:20:32.23, start: 1218.614000, bitrate: 5 kb/s
    Stream #0:0: Video: h264, 30 tbr, 1k tbn, 2k tbc
    Stream #0:1: Audio: aac, 44100 Hz, mono, fltp

% ffmpeg -i tmp/rangetest2.flv -vcodec copy -acodec copy tmp/rangetest2.mp4
ffmpeg version 2.0.1-tessus Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug 10 2013 21:25:56 with llvm-gcc 4.2.1 (LLVM build 2336.1.00)
  configuration: --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-fontconfig --enable-libfreetype --enable-libass --enable-libbluray --enable-filters --enable-runtime-cpudetect
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[h264 @ 0x102020c00] no frame!
    Last message repeated 133 times
[h264 @ 0x102020c00] non-existing PPS 1 referenced
[h264 @ 0x102020c00] decode_slice_header error
[h264 @ 0x102020c00] no frame!
    Last message repeated 16 times
[h264 @ 0x102020c00] non-existing SPS 0 referenced in buffering period
[h264 @ 0x102020c00] no frame!
[flv @ 0x102018600] decoding for stream 0 failed
[flv @ 0x102018600] Could not find codec parameters for stream 0 (Video: h264): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, flv, from 'tmp/rangetest2.flv':
  Duration: 00:20:32.23, start: 1218.614000, bitrate: 5 kb/s
    Stream #0:0: Video: h264, 30 tbr, 1k tbn, 2k tbc
    Stream #0:1: Audio: aac, 44100 Hz, mono, fltp
File 'tmp/rangetest2.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'tmp/rangetest2.mp4':
  Metadata:
    encoder         : Lavf55.12.100
    Stream #0:0: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, mono
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
[flv @ 0x102018600] Stream discovered after head already parsed
[flv @ 0x102018600] New data stream 0:2 at pos:757450 and DTS:1231.23s
size=     134kB time=00:00:14.14 bitrate=  77.6kbits/s    
video:0kB audio:131kB subtitle:0 global headers:0kB muxing overhead 2.402472%


More information about the ffmpeg-user mailing list