VideoHelp Forum




+ Reply to Thread
Results 1 to 25 of 25
  1. Hi guys

    I have some FLV files that I'd like to cut some parts. If the video is encoded with VP6 codec, it's fine. I can use FLVEditor Pro, AVIDemux or Virtualdub with FLV plugin. No prob.

    My problem is H.264 codec. Nobody can open it...

    If I open a FLV with VP6 codec in AVIDemux, it can cut the video and save back without re-encode, saving an AVI with VP6 codec (copy method). The same with VDub using FLV plugin. I get an AVI with VP6 codec (Direct Stream Copy).

    I'm not putting the question on how to convert and edit it after conversion. The point here is how to open a H.264 FLV file to edit/cut and save back without re-encoding or converting anything. The same when I work on a VP6 codec.

    If someone has an idea...
    Thank you.
    Quote Quote  
  2. you can try re-wrapping it

    e.g. flvextract to extract then yamb , mkvtoolnix or avc2avi to rewrap (mp4, mkv, or avi respectively) , then edit that

    if it's vfr, your edits might cause desync , even if you have timecodes muxed into mp4 or mkv
    Quote Quote  
  3. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Hi Jairovital, can you post a sample ?
    Quote Quote  
  4. Poisondeathray
    I could see that MediaInfo reports several kinds of H.264 Format Profiles. Some are Main@L1.3, some are Main@L2.0 and there are Main@L3.1. At first attemp, AVIDemux could not open Main@L3.1. But when I could open Main@L1.3, AVIDemux could open Main@L3.1 one. But when I cut some parts and save as AVI, the result file is black screen all the time, no sound.

    VDub cannot open none of them.

    If I use FLVExtract, VDub can open *.264 file, but when I save Direct Stream Copy, the result file is useless (black screen). Another problem: I can seek the time line, but cannot play (VDub freeze until I hit SPACE to stop).

    But wait! I tryed again and VDub could save a good stream.

    Increadible: Are there no FLV Editor out there? We always need to make juggling to cut videos? Using 3 tools together to get results?

    Below there is a sample, Davexnet:



    Poisondeathray, if you open the sample with AVIDemux it doesn't save a good video (just black screen). Do you know why? And the workaround for it?
    Last edited by jairovital; 19th Sep 2010 at 19:31.
    Thank you.
    Quote Quote  
  5. no there aren't any good editors

    you can't edit the .264 file (elementary stream) , it needs to be in a container

    videoredo beta might be able to , but only for some containers (like .m2ts) - you could use tsmuxer to re-wrap

    some versions of avidemux work better than others , but none of them support saving h.264 in avi (only mp4 or mkv) - that's why you get black screen . You really shouldn't use h.264 in avi there are many problems (b-frame decoder lag, decoding problems) .

    vdub will work, but only if in avi container (but then you get all the other issues) , and your audio might not be supported properly (aac) , unless you convert the audio
    Quote Quote  
  6. After doing too many attempts, putting tools to work as desired, I'll list below how I could get something close what I was looking for:

    01 - FLVExtract, to split FLV in 3 files, *.264, *.aac, *.txt, e.g. video, audio and timecode, respectively
    02 - avc2avi_r594+gui1.2, to wrap *.264 to AVI container
    03 - RiverPastAudio Converter to convert *.aac to wav
    04 - Virtualdub to open *.avi
    05 - Virtualdub to join again video and audio in a new AVI file, using wav file as Other Audio Source, and using some compress (Full Processing Mode)
    06 - Virtualdub to open the new AVI and to find points to cut
    07 - Notepad to write down those list of cuts (begin and end)
    08 - AVIDemux to open the new AVI and proceed the cuts, using Safe Mode, to avoid crashes caused by B-frames references
    09 - Proceed the cuts from the end to begin of video, to obey the chronology of the list of cuts
    10 - Finally, save another new AVI, with H.264 video codec and other audio codec I put in VDub.

    You may ask: why don't proceed the cuts in VDub? A: Because it crashes VDub if I Set Selection Start or End, or even if I play the file. I can only drag the timeline to find the cut points. Other reason: VDub creates a black-screen AVI file, useless...

    And you may ask again: why don't find those points in AVIDemux? A: Because the use of Safe Mode towards to lost the frame accuracy and it becomes unavailable to find that points.

    That was my gymnastic and juggling to achieve a very simple task: cut a H.264 FLV video without convert it or re-encode it.

    If someone else has a better idea he would save me such transpiration...

    Or, the best is to wait a code guru to write some FLVEditor that could handle H.264/AAC codec.
    Thank you.
    Quote Quote  
  7. Member bat999's Avatar
    Join Date
    Feb 2008
    Location
    United Kingdom
    Search Comp PM
    Hi
    Why not attach or upload a sample for others to try.
    It's no use posting a YouTube clip.
    Quote Quote  
  8. One note:
    The steps I listed above is just for Main@L3.0 and above Fortmat Profile. If H.264 is Main@L1.3 to 2.0 Fortmat Profile, AVIDemux is able to handle the video properly.
    Thank you.
    Quote Quote  
  9. Member bat999's Avatar
    Join Date
    Feb 2008
    Location
    United Kingdom
    Search Comp PM
    Hi
    Why not attach or upload a sample for others to try.
    It's no use posting a YouTube clip.
    Quote Quote  
  10. Hey bat999, on the way two samples:

    H.264 AVC Main@L3.0 http://www.4shared.com/video/wgaxj1Jm/720p_HD-_Duck.html
    H.264 AVC Main@L3.1 http://www.4shared.com/video/XzUZ-_65/HD_online.html

    Try to cut and say to me something...
    Thank you.
    Quote Quote  
  11. it works fine.

    flvextract => yamb mp4 => avidemux => mark in/out , save as mp4

    if you use the hd version from youtube (the 720p mp4) , you don' t need flv extract

    when you cut in avidemux, are you cutting on keyframes? (it's not frame accurate, you have to cut/nativate by keyframes. You need videoredo beta to be able to do frame accurate edits - only re-encodes gop around the cutsite)
    Quote Quote  
  12. Poisondeathray
    The problem, I think, it's because I'm cutting elsewhere, not worrying about keyframe. How to know that point is a keyframe or not? AVIDemux only says Frame Type: I(00) anywhere at timeline. When I do as you say, I get a black-screen file.
    Another question, when you say "save as mp4" you mean just the extension of the file and keep CopyMode? Or use MPEG4-AVC at encoders list?
    Thank you.
    Quote Quote  
  13. import as .mp4 (rewrapped from yamb)

    use the "<<" and ">>" buttons at the bottom to navigate to keyframe , and use the mark in/out (buttons looks like "a", "b")

    video=>copy
    audio=>copy
    format=>mp4

    save with extension (e.g. "cutvideo.mp4")
    Quote Quote  
  14. It works better than when I cut elsewhere. I conclude:

    1 - If I cut on a non-keyframe point, result file shows artifacts and garbage at that point. If I cut the begining of the video, the result video is black-screen one.
    2 - If I cut on a keyframe point, result file shows the transition frames of the cut perfectly. A clean cut without artifacts. But I still cannot cut out the beginning of the file. I have to keep the first frames until the first keyframe. Because if I don't do that, the black-screen file comes...

    Please, correct me if I'm wrong
    Thank you.
    Quote Quote  
  15. you have to cut on keyframes and everything works

    you can't cut the 1st frame , because it IS a keyframe (it starts with IDR-frame) - in this particular case (this is not always true - ie . it is possible you can start with Non IDR frame)

    you can cut out the beggining, but only if the mark in 1st cut is on a keyframe (actually the P frame right before I-frame, but people just call it "cut on keyframe", but in fact it's at the end of the GOP, right before the next keyframe)

    anytime you disrupt a GOP (make a cut anywhere that is not end of the GOP i.e. "if don't cut on keyframe") , you have to re-encode at least that entire GOP (avidemux cannot re-encode just a GOP, it has to re-encode the WHOLE file. Programs that can just re-encode that GOP ONLY are called smart editors - thus you can cut anywhere)
    Quote Quote  
  16. Member bat999's Avatar
    Join Date
    Feb 2008
    Location
    United Kingdom
    Search Comp PM
    Hi

    I can understand the method that poisondeathray has suggested.
    Putting the tracks into an MP4 container then using Avidemux to edit them.

    It's also possible to edit those files without any converting or repackaging using ffmpeg.
    They contain x264 video and aac audio tracks.

    The file
    720p HD- Duck.flv
    is 14 seconds.

    If I want to keep the first 10 seconds and trim off the ending use the command:-
    ffmpeg -i "720p HD- Duck.flv" -t 10 -vcodec copy -acodec copy output1.flv
    If I want to trim off the first 10 seconds and keep the rest:-
    ffmpeg -i "720p HD- Duck.flv" -ss 10 -vcodec copy -acodec copy output2.flv
    If I want to trim off the first 5 seconds and the last 5 seconds and keep the middle 4 seconds:-
    ffmpeg -i "720p HD- Duck.flv" -ss 5 -t 4 -vcodec copy -acodec copy output3.flv
    The file
    HD.flv
    is 43 seconds.

    If I want to keep the first 12 seconds and trim off the ending use the command:-
    ffmpeg -i "HD.flv" -t 12 -vcodec copy -acodec copy output4.flv
    If I want to trim off the first 28 seconds and keep the rest:-
    ffmpeg -i "HD.flv" -ss 28 -vcodec copy -acodec copy output5.flv
    If I want to trim off the first 12 seconds and the last 15 seconds and keep the middle 16 seconds:-
    ffmpeg -i "HD.flv" -ss 12 -t 16 -vcodec copy -acodec copy output6.flv
    The results are here:-http://www.mediafire.com/?y6d8bhlkcwm7i0t

    This method is crude because we edit using 'time' instead of a GUI.
    But it's cheap and cheerful.
    Quote Quote  
  17. bat999

    Your sugestion was great! I'm not scared of using command line. But how do you handle with the keyframe approach that Poisondeathray talked about?

    And for Poison, how to know where are P-frame (or I, B,...) using AVIDemux. The program has nothing to say about I, B or P frames. If I understand, I only go to previous or next keyframe using << or >> buttons. VDub inform them when I open a MPEG2 video.
    Thank you.
    Quote Quote  
  18. Member bat999's Avatar
    Join Date
    Feb 2008
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by jairovital View Post
    bat999

    ... But how do you handle with the keyframe approach that Poisondeathray talked about?
    I don't.
    Quote Quote  
  19. Originally Posted by jairovital View Post
    Your sugestion was great! I'm not scared of using command line. But how do you handle with the keyframe approach that Poisondeathray talked about?
    The cuts won't be frame accurate . It will cut at the closest keyframe (similar to what would happen if you were using mkvtoolnix to cut by timecodes)

    And for Poison, how to know where are P-frame (or I, B,...) using AVIDemux. The program has nothing to say about I, B or P frames. If I understand, I only go to previous or next keyframe using << or >> buttons. VDub inform them when I open a MPEG2 video.
    If you want better accuracy and more information, you need other programs e.g. elecard streameye
    Quote Quote  
  20. Poison and bat999

    This morning was great! I think I have enough to do my work.

    Thank you all, guys.

    P.S. and bat999, your avatar make me laugh everytime I see it.
    kidding
    Thank you.
    Quote Quote  
  21. bat999, I'm comming back because I got some errors when I tryed to edit using your method (ffmpeg). If I try to cut two clips or more from the same source, and joining together, I wrote:

    Code:
    ffmpeg -i input.flv -ss 40 -t 60 -vcodec copy -acodec copy output1.flv
    ffmpeg -i input.flv -ss 120 -vcodec copy -acodec copy output2.flv
    ffmpeg -i output1.flv -i output2.flv -vcodec copy -acodec copy -vcodec copy -acodec copy output3.flv -newvideo -newaudio
    Can you see if I'm writing the wrong code? Please, point me the right way to go. Just to make some cuts along the video, more than 2, to explain how it works.

    I'd read the manual but I couldn't understand all the stuff there. Sometimes I get an error like that:

    Code:
     [flv @ 01abcfb0]Estimating duration from bitrate, this may be inaccurate
    Input #0, flv, from 'output1.flv':
      Metadata:
        duration        : 60
        width           : 640
        height          : 480
        videodatarate   : 324
        framerate       : 25
        videocodecid    : 7
        audiodatarate   : 39
        audiosamplerate : 48000
        audiosamplesize : 16
        stereo          : false
        audiocodecid    : 10
        filesize        : 2520971
      Duration: 00:01:00.03, start: 0.000000, bitrate: 371 kb/s
        Stream #0.0: Video: h264, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 331 kb/s, 25 t
    br, 1k tbn, 50 tbc
        Stream #0.1: Audio: aac, 48000 Hz, mono, s16, 40 kb/s
    [flv @ 01c22060]Estimating duration from bitrate, this may be inaccurate
    Input #1, flv, from 'output2.flv':
      Metadata:
        duration        : 594
        width           : 640
        height          : 480
        videodatarate   : 324
        framerate       : 25
        videocodecid    : 7
        audiodatarate   : 39
        audiosamplerate : 48000
        audiosamplesize : 16
        stereo          : false
        audiocodecid    : 10
        filesize        : 28225293
      Duration: 00:09:54.02, start: 0.021000, bitrate: 371 kb/s
        Stream #1.0: Video: h264, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 331 kb/s, 25 t
    br, 1k tbn, 50 tbc
        Stream #1.1: Audio: aac, 48000 Hz, mono, s16, 40 kb/s
    [libmp3lame @ 01d0b010]flv does not support that sample rate, choose from (44100
    , 22050, 11025).
    Output #0, flv, to 'output3.flv':
      Metadata:
        encoder         : Lavf52.68.0
        Stream #0.0: Video: libx264, yuv420p, 640x480 [PAR 1:1 DAR 4:3], q=2-31, 331
     kb/s, 1k tbn, 25 tbc
        Stream #0.1: Audio: aac, 48000 Hz, mono, 40 kb/s
        Stream #0.2: Video: flv, yuv420p, 640x480 [PAR 1:1 DAR 4:3], q=2-31, 200 kb/
    s, 1k tbn, 25 tbc
        Stream #0.3: Audio: libmp3lame, 48000 Hz, mono, s16, 64 kb/s
    Stream mapping:
      Stream #0.0 -> #0.0
      Stream #1.1 -> #0.1
      Stream #1.0 -> #0.2
      Stream #0.1 -> #0.3
     Could not write header for output file #0 (incorrect codec parameters ?)
    Do you know what is happening? I use same source and there is no reason it says flv does not support that sample rate...

    There are other problems: because we don't care about keyframe, the result video, sometimes, doesn't show a perfect seam. And it hurts the audio too...

    May be my honey-moon with ffmpeg is comming to end...
    Time to come back to AVIDemux and to that todo list I posted early.

    I'm attaching a new sample, a longer one:

    http://www.4shared.com/video/tFY40fCx/Step_Up_3D_Trailer_HD.html
    Thank you.
    Quote Quote  
  22. Member bat999's Avatar
    Join Date
    Feb 2008
    Location
    United Kingdom
    Search Comp PM
    Hi
    I don't think that you can use ffmpeg to join the clips.

    Were you able to cut and trim the clips using those 3 types of commands in my other post?

    Maybe I'm wrong.
    Perhaps this is the command to use:-
    ffmpeg -i output1.flv -i output2.flv output3.flv
    Last edited by bat999; 20th Sep 2010 at 15:25.
    Quote Quote  
  23. Yes, I was able to cut using your commands.
    And yes, I did join the clips using the commands I post at #21.

    The problem is the keyframes involved. How to find them and to cut on "the head" of them. I can find using AVIDemux ou VDub, but it demands too much work and it's better to go to other methods.
    Thank you.
    Quote Quote  
  24. Member bat999's Avatar
    Join Date
    Feb 2008
    Location
    United Kingdom
    Search Comp PM
    Hi
    ffmpeg isn't good enough to do serious editing.
    Quote Quote  
  25. For those who want to try to cut a H.264 files, there is another sample:

    Format Profile: Main@L3.0
    http://www.4shared.com/video/tY3tJUcJ/Big_Buck_Bunny.html
    Thank you.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!