VideoHelp Forum
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Hello,
    i am trying to cut a video with ffmpeg while keeping the same format and without reencoding the video.

    The problem is that the format of the output is not the same.

    The audio bitrate is less, the video bitrate is slightly changed and also the clip info has changed (this is only metadata right ?)

    Also, the input file was a MP4, can ffmpeg keep the same format with all video formats ? Such as AVI, WMV, MOV, DIVX etc. ?

    Thank you !

    Command Line Arguments

    Code:
    ffmpeg.exe  -y -i "C:\Movies\304640436.mp4"  -ss 00:00:06.5 -t 8.40 "C:\Movies\304640436.clipped.mp4"
    Mplayer Identify Output

    Original

    Code:
    MPlayer2 git-6ce3c2a (C) 2000-2013 MPlayer2 Team
    Custom build by Redxii, http://smplayer.sourceforge.net
    Compiled against Libav version v9-553-g311443f
    Build date: Fri Feb 22 16:43:48 EST 2013
    
    Playing c:\movies\304640436.mp4.
    Detected file format: QuickTime / MOV (libavformat)
    ID_VIDEO_ID=0
    [lavf] stream 0: video (h264), -vid 0
    ID_AUDIO_ID=0
    ID_AID_0_LANG=und
    [lavf] stream 1: audio (aac), -aid 0, -alang und
    [ass] No usable fontconfig configuration file found, using fallback.
    Clip info:
     major_brand: mp42
    ID_CLIP_INFO_NAME0=major_brand
    ID_CLIP_INFO_VALUE0=mp42
     minor_version: 0
    ID_CLIP_INFO_NAME1=minor_version
    ID_CLIP_INFO_VALUE1=0
     compatible_brands: mp42mp41isomavc1
    ID_CLIP_INFO_NAME2=compatible_brands
    ID_CLIP_INFO_VALUE2=mp42mp41isomavc1
     creation_time: 2014-11-06 00:14:31
    ID_CLIP_INFO_NAME3=creation_time
    ID_CLIP_INFO_VALUE3=2014-11-06 00:14:31
    ID_CLIP_INFO_N=4
    Load subtitles in c:\movies\
    ID_FILENAME=c:\movies\304640436.mp4
    ID_DEMUXER=lavfpref
    ID_VIDEO_FORMAT=H264
    ID_VIDEO_BITRATE=4441456
    ID_VIDEO_WIDTH=1920
    ID_VIDEO_HEIGHT=1080
    ID_VIDEO_FPS=25.000
    ID_VIDEO_ASPECT=1.7778
    ID_AUDIO_FORMAT=MP4A
    ID_AUDIO_BITRATE=256000
    ID_AUDIO_RATE=48000
    ID_AUDIO_NCH=2
    ID_START_TIME=0.00
    ID_LENGTH=170.04
    ID_SEEKABLE=1
    ID_CHAPTERS=0
    <vo_directx><ERROR>Your card doesn't support overlay
    Opening video filter: [scale]
    [ass] auto-open
    Selected video codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [libavcodec]
    ID_VIDEO_CODEC=ffh264
    Selected audio codec: AAC (Advanced Audio Coding) [libavcodec]
    AUDIO: 48000 Hz, 2 ch, floatle, 256.0 kbit/8.33% (ratio: 32000->384000)
    ID_AUDIO_BITRATE=256000
    ID_AUDIO_RATE=48000
    ID_AUDIO_NCH=2
    AO: [dsound] 48000Hz 2ch s16le (2 bytes per sample)
    ID_AUDIO_CODEC=ffaac
    Starting playback...
    VIDEO:  1920x1080  25.000 fps  4441.5 kbps (555.2 kB/s)
    ID_VIDEO_ASPECT=1.7778
    [swscaler @ 02205d80]using unscaled yuv420p -> bgra special converter
    VO: [directx] 1920x1080 => 1920x1080 BGRA 
    No bind found for key '0x1b    '.
    
    Exiting... (Quit)
    ID_EXIT=QUIT
    Clipped

    Code:
    MPlayer2 git-6ce3c2a (C) 2000-2013 MPlayer2 Team
    Custom build by Redxii, http://smplayer.sourceforge.net
    Compiled against Libav version v9-553-g311443f
    Build date: Fri Feb 22 16:43:48 EST 2013
    
    Playing c:\movies\304640436.clipped.mp4.
    Detected file format: QuickTime / MOV (libavformat)
    ID_VIDEO_ID=0
    [lavf] stream 0: video (h264), -vid 0
    ID_AUDIO_ID=0
    ID_AID_0_LANG=und
    [lavf] stream 1: audio (aac), -aid 0, -alang und
    [ass] No usable fontconfig configuration file found, using fallback.
    Clip info:
     major_brand: isom
    ID_CLIP_INFO_NAME0=major_brand
    ID_CLIP_INFO_VALUE0=isom
     minor_version: 512
    ID_CLIP_INFO_NAME1=minor_version
    ID_CLIP_INFO_VALUE1=512
     compatible_brands: isomiso2avc1mp41
    ID_CLIP_INFO_NAME2=compatible_brands
    ID_CLIP_INFO_VALUE2=isomiso2avc1mp41
     encoder: Lavf55.12.102
    ID_CLIP_INFO_NAME3=encoder
    ID_CLIP_INFO_VALUE3=Lavf55.12.102
    ID_CLIP_INFO_N=4
    Load subtitles in c:\movies\
    ID_FILENAME=c:\movies\304640436.clipped.mp4
    ID_DEMUXER=lavfpref
    ID_VIDEO_FORMAT=H264
    ID_VIDEO_BITRATE=4654776
    ID_VIDEO_WIDTH=1920
    ID_VIDEO_HEIGHT=1080
    ID_VIDEO_FPS=25.000
    ID_VIDEO_ASPECT=1.7778
    ID_AUDIO_FORMAT=MP4A
    ID_AUDIO_BITRATE=128536
    ID_AUDIO_RATE=48000
    ID_AUDIO_NCH=2
    ID_START_TIME=-0.03
    ID_LENGTH=8.43
    ID_SEEKABLE=1
    ID_CHAPTERS=0
    <vo_directx><ERROR>Your card doesn't support overlay
    Opening video filter: [scale]
    [ass] auto-open
    Selected video codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [libavcodec]
    ID_VIDEO_CODEC=ffh264
    Selected audio codec: AAC (Advanced Audio Coding) [libavcodec]
    AUDIO: 48000 Hz, 2 ch, floatle, 128.5 kbit/4.18% (ratio: 16067->384000)
    ID_AUDIO_BITRATE=128536
    ID_AUDIO_RATE=48000
    ID_AUDIO_NCH=2
    AO: [dsound] 48000Hz 2ch s16le (2 bytes per sample)
    ID_AUDIO_CODEC=ffaac
    Starting playback...
    VIDEO:  1920x1080  25.000 fps  4654.8 kbps (581.8 kB/s)
    ID_VIDEO_ASPECT=1.7778
    [swscaler @ 02205d80]using unscaled yuv420p -> bgra special converter
    VO: [directx] 1920x1080 => 1920x1080 BGRA 
    No bind found for key '0x1b    '.
    
    Exiting... (Quit)
    ID_EXIT=QUIT
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Add
    Code:
    -vcodec copy -acodec copy
    To copy the video and audio stream.
    Code:
    ffmpeg.exe  -y -i "C:\Movies\304640436.mp4" -vcodec copy -acodec copy -ss 00:00:06.5 -t 8.40 "C:\Movies\304640436.clipped.mp4"
    Quote Quote  
  3. Thank you for your answer.

    Do you also know how to accurately cut the video with ffmpeg while doing a bitstream copy ?

    The ffmpeg site says :
    Code:
    Seeking while doing a bitstream copy
    
    Using -ss as input option together with -c:v copy might not be accurate since ffmpeg is forced to only use/split on i-frames. Though it will—if possible—adjust the start time of the stream to a negative value to compensate for that.
    I have found also this thread :
    https://forum.videohelp.com/threads/359491-Just-an-idea-ffmpeg-based-key-frame-accurate-cutting

    but did not understand their conclusion.

    Thanks !
    Quote Quote  
  4. It's not possible to get frame accuracy in ffmpeg, unless the source video is intra encoded (I frame only)

    You cannot cut in the middle of a GOP , because frames rely on data from other frames within a GOP
    Quote Quote  
  5. would it not be possible to write a program to find the most close I frame (or how else it is called - sorry i do not know the terminology)
    and then pass in the -ss parameter the time of this frame as a value ?
    Quote Quote  
  6. Member hech54's Avatar
    Join Date
    Jul 2001
    Location
    Yank in Europe
    Search PM
    Originally Posted by alexander121 View Post
    would it not be possible to write a program to find the most close I frame (or how else it is called - sorry i do not know the terminology)
    and then pass in the -ss parameter the time of this frame as a value ?
    Yes....you will find dozens of them in the TOOLS section....many of them are FREE. They show you exactly where you are cutting and they show/tell you if you can cut there losslessly. They are called Video Editors. AviDemux is my personal favorite.
    I'll never understand the fascination with the frustration of Command Line devotees.....especially with simple video cuts.
    Quote Quote  
  7. would it not be possible to write a program to find the most close I frame (or how else it is called - sorry i do not know the terminology)
    That is what ffmpeg normally does automatically.
    If the time doesn't hit a key frame the previous key frame will be used as starting point for the cut.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!