Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
basic video editing
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Sun Oct 16, 2011 9:16 pm    Post subject: basic video editing Reply with quote

I have a series (of five) .flv files that I want to combine into one file.

First of all, I tried putting them together in avidemux, but the sound is out of sync by the end (all of the files play perfectly by themselves).

Next I thought I would try to (initially) put them into mkv containers, but I ended up with this:

Code:

$ ffmpeg -i file1.flv -acodec copy -vcodec copy file1.mkv
ffmpeg version 0.7.6, Copyright (c) 2000-2011 the FFmpeg developers
  built on Oct 10 2011 13:57:35 with gcc 4.5.3
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --disable-static --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --disable-stripping --disable-debug --disable-doc --disable-vaapi --enable-libmp3lame --enable-libvo-aacenc --enable-libtheora --enable-libvorbis --enable-libxvid --disable-indev=v4l --disable-indev=oss --disable-indev=jack --enable-x11grab --disable-outdev=oss --enable-libfreetype --enable-pthreads --enable-librtmp --enable-libspeex --disable-altivec --disable-avx --disable-amd3dnow --disable-amd3dnowext --cpu=host --enable-hardcoded-tables
  libavutil    50. 43. 0 / 50. 43. 0
  libavcodec   52.122. 0 / 52.122. 0
  libavformat  52.110. 0 / 52.110. 0
  libavdevice  52.  5. 0 / 52.  5. 0
  libavfilter   1. 80. 0 /  1. 80. 0
  libswscale    0. 14. 1 /  0. 14. 1
  libpostproc  51.  2. 0 / 51.  2. 0
[flv @ 0x1942e90] Estimating duration from bitrate, this may be inaccurate
                                                                                                                                                                                   
Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)
Input #0, flv, from 'file1.flv':
  Metadata:
    audiocodecid    : 2
    audiodatarate   : 128
    canseektoend    : false
    creationdate    : Mon Oct 10 07:14:36 2011

    duration        : 896
    framerate       : 25
    height          : 576
    lastkeyframetimestamp: 896200
    lasttimestamp   : 896208
    metadatacreator : On2 Flix SDK for Dshow_2.4.5.0
    On2             : Technologies
    profile         : VP6-E
    videocodecid    : 4
    videodatarate   : 2364
    width           : 1024
  Duration: 00:14:56.23, start: 0.000000, bitrate: 2549 kb/s
    Stream #0.0: Video: vp6f, yuv420p, 1024x576, 2421 kb/s, 25 tbr, 1k tbn, 1k tbc
    Stream #0.1: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
Output #0, matroska, to 'file1.mkv':
  Metadata:
    audiocodecid    : 2
    audiodatarate   : 128
    canseektoend    : false
    creationdate    : Mon Oct 10 07:14:36 2011

    duration        : 896
    framerate       : 25
    height          : 576
    lastkeyframetimestamp: 896200
    lasttimestamp   : 896208
    metadatacreator : On2 Flix SDK for Dshow_2.4.5.0
    On2             : Technologies
    profile         : VP6-E
    videocodecid    : 4
    videodatarate   : 2364
    width           : 1024
    encoder         : Lavf52.110.0
    Stream #0.0: Video: VP6F / 0x46365056, yuv420p, 1024x576, q=2-31, 2421 kb/s, 1k tbn, 1k tbc
    Stream #0.1: Audio: libmp3lame, 44100 Hz, stereo, 128 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop, [?] for help
[matroska @ 0x19406e0] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 12772 >= 12750
av_interleaved_write_frame(): Invalid data found when processing input


I am sure people have encountered problems like this before. What is the best way of getting around them?
Back to top
View user's profile Send private message
CrankyPenguin
Apprentice
Apprentice


Joined: 19 Jun 2003
Posts: 283

PostPosted: Sun Oct 16, 2011 11:15 pm    Post subject: Two suggestions. Reply with quote

I've had similar issues and sometimes succeeded with them.

Firstly I suspect avidemux won't help you with flv files. I know that they are video files but I am not sure how well supported they are. I used to use avidemux but now turn to mencoder to handle my demuxing tasks. I recommend using mencoder to either convert the files say to mpeg then perform any linking and demuxing in that, better supported format. If you want to keep them as flv files then you can have mencoder split them into separate audio and video tracks using the -ao file: and -vo file: options. That will then allow you to manipulate them separately.

In general, be wary of concatenating many audio and video file types. I've found that many of them don't play well with that which is why I tend to favor the convert-to-mpeg approach.
_________________
Linux, the OS for the obsessive-compulsive speed freak in all of us.
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Mon Oct 17, 2011 8:24 am    Post subject: Re: Two suggestions. Reply with quote

CrankyPenguin wrote:
Firstly I suspect avidemux won't help you with flv files. I know that they are video files but I am not sure how well supported they are.


They open and play fine in just about anything (mplayer, ffmpeg, avidemux), and avidemux doesn't complain about writing them.

CrankyPenguin wrote:
I recommend using mencoder to either convert the files say to mpeg then perform any linking and demuxing in that, better supported format. If you want to keep them as flv files then you can have mencoder split them into separate audio and video tracks using the -ao file: and -vo file: options.


Define "convert." Obviously, I want to avoid any kind of recompression (which means a quality loss). I have no aversion to putting them in any reasonable container.

Why mencoder over ffmpeg? I don't know anything about the details, but I have seen numerous comments that the quality of the mencoder code is quite poor (and I believe it uses an old version of ffmpeg as its base anyway).

CrankyPenguin wrote:
In general, be wary of concatenating many audio and video file types. I've found that many of them don't play well with that which is why I tend to favor the convert-to-mpeg approach.


I am confused. What does "concatenating many audio and video file types" mean? In this case, I am trying to put together five identically encoded flv files (obviously mixing files types is an invitation for a disaster).
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2581
Location: Here and Away Again

PostPosted: Mon Oct 17, 2011 12:09 pm    Post subject: Reply with quote

Regarding avidemux, when ever I have sync issues, I would usually just re-encode with something like mp3 for the audio and lately for the video I often use MPEG-4 AVC, and an avi container, the sync issues when saving an flv file for example are gone. If you specifically need flv, even then I'm quite sure there is a way to get the audio back to sync (change of codec or its settings).

Might play around with them actually myself later today, or in the something-something future.
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Mon Oct 17, 2011 11:25 pm    Post subject: Reply with quote

I don't care about the container, but I want to avoid re-encoding.

Why couldn't ffmpeg put the data into an mkv container?
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2581
Location: Here and Away Again

PostPosted: Tue Oct 18, 2011 12:11 am    Post subject: Hm. Reply with quote

I've been sort of avoiding ffmpeg in the command-line as it is the beast that it is!
So I don't know too much about it, though I should eventually just get into it... definitely.

Anyways, I tried some quick tests and I had no problems with the exact command you are using.
Something that I does seem odd to me in your log is this part:

Code:
Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)

Frame rate of 1000.00?
Perhaps this is normal for whatever reason but it does seem odd to me...

Here's the output from a quick test for comparison (I tried with different video files, this is with an flv, as you can see):

Code:
 ~ $ ffmpeg -i testin1.flv -acodec copy -vcodec copy testout1.mkv
ffmpeg version 0.7.6, Copyright (c) 2000-2011 the FFmpeg developers
  built on Oct  7 2011 17:57:21 with gcc 4.4.5
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --disable-static --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --disable-stripping --disable-debug --disable-doc --disable-network --disable-vaapi --disable-ffplay --disable-vdpau --enable-libmp3lame --enable-libvo-aacenc --enable-libvorbis --enable-libx264 --enable-libxvid --disable-indev=v4l --disable-indev=v4l2 --disable-indev=oss --enable-x11grab --disable-outdev=oss --enable-libfreetype --enable-pthreads --enable-libdirac --enable-libschroedinger --enable-libopenjpeg --disable-altivec --disable-avx --cpu=amdfam10 --enable-hardcoded-tables
  libavutil    50. 43. 0 / 50. 43. 0
  libavcodec   52.122. 0 / 52.122. 0
  libavformat  52.110. 0 / 52.110. 0
  libavdevice  52.  5. 0 / 52.  5. 0
  libavfilter   1. 80. 0 /  1. 80. 0
  libswscale    0. 14. 1 /  0. 14. 1
  libpostproc  51.  2. 0 / 51.  2. 0
[flv @ 0x652370] Estimating duration from bitrate, this may be inaccurate
                                                                                                                                         
Seems stream 0 codec frame rate differs from container frame rate: 59.93 (29963/500) -> 59.92 (719/12)
Input #0, flv, from testin1.flv:
  Metadata:
    duration        : 156
    starttime       : 0
    totalduration   : 156
    width           : 480
    height          : 338
    videodatarate   : 451
    audiodatarate   : 115
    totaldatarate   : 573
    framerate       : 30
    bytelength      : 11188468
    canseekontime   : true
    sourcedata      : BADC239A2HH1318894922553583
    purl            :
    pmsg            :
  Duration: 00:02:35.55, start: 0.000000, bitrate: 579 kb/s
    Stream #0.0: Video: h264 (Main), yuv420p, 480x338 [PAR 1:1 DAR 240:169], 461 kb/s, 59.92 tbr, 1k tbn, 59.93 tbc
    Stream #0.1: Audio: aac, 44100 Hz, stereo, s16, 118 kb/s
Output #0, matroska, to testout1.mkv:
  Metadata:
    duration        : 156
    starttime       : 0
    totalduration   : 156
    width           : 480
    height          : 338
    videodatarate   : 451
    audiodatarate   : 115
    totaldatarate   : 573
    framerate       : 30
    bytelength      : 11188468
    canseekontime   : true
    sourcedata      : BADC239A2HH1318894922553583
    purl            :
    pmsg            :
    encoder         : Lavf52.110.0
    Stream #0.0: Video: libx264, yuv420p, 480x338 [PAR 1:1 DAR 240:169], q=2-31, 461 kb/s, 1k tbn, 29.96 tbc
    Stream #0.1: Audio: libvo_aacenc, 44100 Hz, stereo, 118 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop, [?] for help
frame= 4662 fps=  0 q=-1.0 Lsize=   10803kB time=00:02:35.59 bitrate= 568.8kbits/s   
video:8537kB audio:2185kB global headers:0kB muxing overhead 0.753017%

I will try to look into it more at a better time, though someone with more knowledge in this might likely post a solution before that. ^^
Good luck!
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
CrankyPenguin
Apprentice
Apprentice


Joined: 19 Jun 2003
Posts: 283

PostPosted: Tue Oct 18, 2011 5:15 pm    Post subject: In answer to your questions. Reply with quote

Quote:
They open and play fine in just about anything (mplayer, ffmpeg, avidemux), and avidemux doesn't complain about writing them.


I have found, purely by trial and error that some tools will play files but not encode them properly. I am not sure why but I have found times where a given mpeg file plays or encodes better through ffmpeg than avidemux and vice-versa. It seems that there is some leeway in the way things are setup. In the past I've tended to resolve this through trial and error.

Quote:
Define "convert." Obviously, I want to avoid any kind of recompression (which means a quality loss). I have no aversion to putting them in any reasonable container.


By convert I meant changing them into a different format. As I said I've found flv's to be a difficult beast because of their compression structure so I tend to convert them to mpegs and then work with those. If you can get them to work then by all means do so, and please share your findings.


[quote]Why mencoder over ffmpeg? I don't know anything about the details, but I have seen numerous comments that the quality of the mencoder code is quite poor (and I believe it uses an old version of ffmpeg as its base anyway). [*quote]

I have found mencoder's command line to be more usable than ffmpeg and have found that it did better, again purely trial and error, than some other files. I had, however been under the impression that it linked against the current ffmpeg on the system so I did not think that there was a difference between ffpeg through mencoder and ffmpeg separately. Where did you read that?

Quote:
I am confused. What does "concatenating many audio and video file types" mean? In this case, I am trying to put together five identically encoded flv files (obviously mixing files types is an invitation for a disaster).

Let me rephrase it then. I though you had five flv files and you simply want to concatenate them one after the other to result in a single full-length file. What I was trying to state is that in some cases I have found that converting all files to mpegs, even if they are the same file type initially, makes it easier to perform this process. Again this is all my experience through trial and error. others have likely had different experience.
_________________
Linux, the OS for the obsessive-compulsive speed freak in all of us.
Back to top
View user's profile Send private message
curmudgeon
Veteran
Veteran


Joined: 08 Aug 2003
Posts: 1741

PostPosted: Sat Oct 22, 2011 8:07 am    Post subject: Re: In answer to your questions. Reply with quote

CrankyPenguin wrote:
By convert I meant changing them into a different format. As I said I've found flv's to be a difficult beast because of their compression structure so I tend to convert them to mpegs and then work with those. If you can get them to work then by all means do so, and please share your findings.


That is STILL not clear. FLV is a container (http://en.wikipedia.org/wiki/Flv) which holds different types of video (most commonly vp6 and h.264) and audio (mp3, aac, adpcm, speex) media.

I can't tell whether you mean moving the media to a different container (which I tried to do - with a destination of the well-supported mkv container), or reencoding the media using different codecs (a quality loss that I want to avoid).

CrankyPenguin wrote:
I had, however been under the impression that it linked against the current ffmpeg on the system so I did not think that there was a difference between ffpeg through mencoder and ffmpeg separately. Where did you read that?


If I recall, ffmpeg used to "never" release, so it was impossible to get any kind of consistency of packages depending on it, and projects such as mplayer just took a snapshot and used that.

Anyway, take a look at your source (less /usr/portage/distfiles/mplayer-1.0_rc4_p20110322.tar.xz). You will find their version of ffmpeg in there.

Even better, look at the ebuilds.

/usr/portage/media-video/mplayer/mplayer-1.0_rc4_p20110322-r1.ebuild:

Code:

[...]
[[ ${PV} == *9999* ]] && IUSE+=" external-ffmpeg"
[...]
[[ ${PV} == *9999* ]] && RDEPEND+=" external-ffmpeg? ( media-video/ffmpeg )"
[...]
    ###################
    # External FFmpeg #
    ###################
    if [[ ${PV} == *9999* ]]; then
        use external-ffmpeg && myconf+=" --disable-ffmpeg_a"
    fi
[...]


/usr/portage/media-video/mplayer/mplayer-9999.ebuild:

Code:

[...]
RDEPEND+="
[...]
    >=virtual/ffmpeg-0.6.90
[...]


Strange. There is an external-ffmpeg USE flag in the stable version (which can't be accessed, because the version is not 9999, so the user must use the internal ffmpeg), but in the 9999 version, there is again no choice, and this time the user must use the system ffmpeg.

CrankyPenguin wrote:
I though you had five flv files and you simply want to concatenate them one after the other to result in a single full-length file.


No, I don't want to concatenate the files - I want to concatenate the media inside of those files, and I don't care (within reason) what container they end up in (I chose mkv because mkv supports the most video formats).
Back to top
View user's profile Send private message
CrankyPenguin
Apprentice
Apprentice


Joined: 19 Jun 2003
Posts: 283

PostPosted: Sat Oct 22, 2011 6:44 pm    Post subject: Reply with quote

Quote:
No, I don't want to concatenate the files - I want to concatenate the media inside of those files, and I don't care (within reason) what container they end up in (I chose mkv because mkv supports the most video formats).


Right again phrasing I guess. I see the concatenation of the container files as concatenating the media in them. In any event good luck. I'm afraid I've had little success with flv files.
_________________
Linux, the OS for the obsessive-compulsive speed freak in all of us.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum