[FFmpeg-user] Right way to extract and recombine audio/video streams?

Gilles codecomplete at free.fr
Thu May 2 12:38:25 CEST 2013


On Tue, 30 Apr 2013 15:43:00 +0200, Werner Robitza
<werner.robitza at gmail.com> wrote:
>The problem here is that you're extracting to raw bitstreams (H.264 or
>AAC), without any container. Raw bitstreams usually don't carry any info
>about the duration of the contents, the frame sizes or frame rates, or any
>metadata. If you want to edit such a stream, that may turn out cumbersome,
>or near impossible.
>
>Rather try to mux into a container that can be easily parsed and opened
>with (almost) any video or audio editor:
>
>ffmpeg -i input.flv -c:v copy -an output.m4v
>ffmpeg -i input.flv -c:a copy -vn output.m4a
>
>Mux with:
>
>ffmpeg -i input.m4v -i input.m4a -c copy output.mp4
>
>You need -c copy here to make sure the bitstreams aren't converted again.

Thanks a lot for the explanation.

I tried demuxing the video stream from an FLV file, but it didn't
work:

[C:\]ffmpeg.exe -i input.flv -c:v copy -an output.m4v

ffmpeg version N-52045-g694fa00 Copyright (c) 2000-2013 the FFmpeg
developers
  built on Apr 12 2013 16:54:51 with gcc 4.8.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc
--enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid
--enable-zlib
  libavutil      52. 26.100 / 52. 26.100
  libavcodec     55.  2.100 / 55.  2.100
  libavformat    55.  2.100 / 55.  2.100
  libavdevice    55.  0.100 / 55.  0.100
  libavfilter     3. 53.101 /  3. 53.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Input #0, flv, from 'input.flv':
  Metadata:
    starttime       : 0
    totalduration   : 608
    totaldatarate   : 357
    bytelength      : 27108207
    canseekontime   : true
    sourcedata      : BD075FE65HM1367490482601026
    purl            :
    pmsg            :
  Duration: 00:10:07.84, start: 0.000000, bitrate: 356 kb/s
    Stream #0:0: Video: flv1, yuv420p, 426x240, 291 kb/s, 29.97 tbr,
1k tbn, 1k tbc
    Stream #0:1: Audio: mp3, 22050 Hz, stereo, s16p, 65 kb/s
File 'output.m4v' already exists. Overwrite ? [y/N] y
track 0: could not find tag, codec not currently supported in
container
Output #0, ipod, to 'output.m4v':
  Metadata:
    starttime       : 0
    totalduration   : 608
    totaldatarate   : 357
    bytelength      : 27108207
    canseekontime   : true
    sourcedata      : BD075FE65HM1367490482601026
    purl            :
    pmsg            :
    encoder         : Lavf55.2.100
    Stream #0:0: Video: flv1, yuv420p, 426x240, q=2-31, 291 kb/s, 90k
tbn, 1k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Could not write header for output file #0 (incorrect codec parameters
?): Operation not permitted



More information about the ffmpeg-user mailing list