Converting a .flv file to .mp4 format through ffmpeg results in error

5,421

As mentioned in the comments, ffmpeg does not mux flv1 video streams in MP4.

Re-encode instead:

ffmpeg -i flv.flv -vcodec libx264 -acodec copy flv.mp4
Share:
5,421

Related videos on Youtube

Chris Palmer Breuer
Author by

Chris Palmer Breuer

Updated on September 18, 2022

Comments

  • Chris Palmer Breuer
    Chris Palmer Breuer over 1 year

    I currently use ffmpeg version 3.2.2, and the issue I run into is that when I try to convert a sample .flv file, it does not convert it properly to a the expected .mp4 format. The error I come across:

    ffmpeg -i flv.flv -vcodec copy -acodec copy flv.mp4
    ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
      built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
      libavutil      55. 34.100 / 55. 34.100
      libavcodec     57. 64.101 / 57. 64.101
      libavformat    57. 56.100 / 57. 56.100
      libavdevice    57.  1.100 / 57.  1.100
      libavfilter     6. 65.100 /  6. 65.100
      libavresample   3.  1.  0 /  3.  1.  0
      libswscale      4.  2.100 /  4.  2.100
      libswresample   2.  3.100 /  2.  3.100
      libpostproc    54.  1.100 / 54.  1.100
    [flv @ 0x7f9af4800000] audio stream discovered after head already parsed
    [flv @ 0x7f9af4800000] video stream discovered after head already parsed
    Input #0, flv, from 'flv.flv':
      Metadata:
        encoder         : Lavf53.24.2
      Duration: 00:00:26.40, start: 0.000000, bitrate: 1589 kb/s
        Stream #0:0: Audio: aac (LC), 48000 Hz, 5.1, fltp
        Stream #0:1: Video: flv1, yuv420p, 1280x720, 25 fps, 25 tbr, 1k tbn
    File 'flv.mp4' already exists. Overwrite ? [y/N] y
    [mp4 @ 0x7f9af5829e00] Could not find tag for codec flv1 in stream #0, codec not currently supported in container
    Could not write header for output file #0 (incorrect codec parameters ?): Invalid argumentStream mapping:
      Stream #0:1 -> #0:0 (copy)
      Stream #0:0 -> #0:1 (copy)
        Last message repeated 1 times
    

    I tried using some online converters to see if they have issues converting the file, but all of them converted it properly to mp4.

    I would appreciate any help on this!

    • Ipor Sircer
      Ipor Sircer over 7 years
      This message is very clear: "codec not currently supported in container". I think online converters also reencode the video to be fit in mp4.
    • Elisa Cha Cha
      Elisa Cha Cha over 7 years
      @IporSircer You could make that the answer. "flv1" / Sorenson Spark / Sorenson H.263 (Flash Video) isn't supported in MP4 container and the online converters re-encode instead of re-mux.
    • Chris Palmer Breuer
      Chris Palmer Breuer over 7 years
      Thanks for your comments. I'm very new to this topic, so any advice helps. It might seem obvious to some, but for me, I don't think I fully even understand what a "codec" is. I am just working on a project that allows user to upload video, but I am trying to have the video be able to be streamed, so some formats I think I will have to convert.
    • Elisa Cha Cha
      Elisa Cha Cha over 7 years
      @IporSircer Nevermind. You were beaten to it. Got to be quick.