Welcome!
Important information
-- Spectre and Meltdown vulnerabilities
-- Change in MX sources

News
-- MX Linux on social media: here
-- Mepis support still here

Current releases
-- MX-17.1 Final release info here
-- antiX-17 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

Question Concerning Copying vs Transcoding

Post Reply
Message
Author
User avatar
joany
Forum Veteran
Forum Veteran
Posts: 5919
Joined: Mon Feb 12, 2007 1:45 pm

Question Concerning Copying vs Transcoding

#1 Post by joany » Mon Sep 08, 2014 10:47 am

The following simple code can convert .flv video files into .mp4 format:

Code: Select all

ffmpeg -i infile.flv -codec copy outfile.mp4
The above conversion process is very fast. It's just as fast as copying it and uses very few resources -- when it works. But occasionally there are .flv files that cannot be converted with this technique, which throws up errors about the -codec parameter:

Code: Select all

[mp4 @ 0x9e11fa0] Could not find tag for codec flv1 in stream #0, codec not currently supported in container
Output #0, mp4, to 'shelly.mp4':

Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
When such .flv files are encountered, they can be transcoded with HandBrake or a modified ffpeg command. Unfortunately transcoding takes a long time and uses a lot of resources.

1. Can someone explain why the simple copying technique works for some .flv files and not others?
2. Can someone offer an improved copying command that works for all .flv files?
MX-14; 3.12-0.bpo.1-686-pae kernel using 4GB RAM
2.4GHz AMD Athlon 4600+
NVidia GeForce 6150 LE; 304.121 Display Driver
You didn't slow down because you're old; you're old because you slowed down.

User avatar
dolphin_oracle
Forum Veteran
Forum Veteran
Posts: 9066
Joined: Sun Dec 16, 2007 1:17 pm

Re: Question Concerning Copying vs Transcoding

#2 Post by dolphin_oracle » Mon Sep 08, 2014 2:29 pm

I think that the -codec copy command is only demuxing, not transcoding, so you are in effect just copying the movie stream from one container to another. I suspect that the times when this fails, the stream contained in the flv file is not able to be demuxed to to mpg4 directly. that's when you have to transcode, which as you noted takes forever.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad T530 - MX-17
lenovo s21e & 100s - antiX-17, MX17(live-usb)
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
joany
Forum Veteran
Forum Veteran
Posts: 5919
Joined: Mon Feb 12, 2007 1:45 pm

Re: Question Concerning Copying vs Transcoding

#3 Post by joany » Mon Sep 08, 2014 3:15 pm

dolphin_oracle wrote:I think that the -codec copy command is only demuxing, not transcoding, so you are in effect just copying the movie stream from one container to another. I suspect that the times when this fails, the stream contained in the flv file is not able to be demuxed to to mpg4 directly. that's when you have to transcode, which as you noted takes forever.
Thanks. I figured it has something to do with how the .flv file is authored, but I didn't know exactly what the reason was. In order to view videos on my Kindle or through my BluRay player, they need to be in .mp4 format. It would be nice if everyone could settle on one video codec standard instead of half a dozen different ones ... sigh.
MX-14; 3.12-0.bpo.1-686-pae kernel using 4GB RAM
2.4GHz AMD Athlon 4600+
NVidia GeForce 6150 LE; 304.121 Display Driver
You didn't slow down because you're old; you're old because you slowed down.

User avatar
dolphin_oracle
Forum Veteran
Forum Veteran
Posts: 9066
Joined: Sun Dec 16, 2007 1:17 pm

Re: Question Concerning Copying vs Transcoding

#4 Post by dolphin_oracle » Mon Sep 08, 2014 4:30 pm

look for more confusion on web formats as HTML5 takes over. webm and vorbis formats are built in to the HTML5 spec. in fact, youtube seems to like my videos better when encoded in webm rather than mp4.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad T530 - MX-17
lenovo s21e & 100s - antiX-17, MX17(live-usb)
FYI: mx "test" repo is not the same thing as debian testing repo.

User avatar
Stevo
Forum Veteran
Forum Veteran
Posts: 15966
Joined: Fri Dec 15, 2006 8:07 pm

Re: Question Concerning Copying vs Transcoding

#5 Post by Stevo » Mon Sep 08, 2014 5:42 pm

.flv files can contain video in several different codec formats. Though almost all now are encoded in h.264, which mp4 does support, originally Flash did not have support for that codec, and they used several different proprietary codecs, such as h.263. The message you are getting means that the .mp4 container doesn't support that older flv1 codec, so it needs to be transcoded to something that it does support.

According to Wikipedia, full h.264 support was added to Flash 10 in 2008.

Post Reply

Return to “Software / Configuration”