Hello
I tried the following command to split an MP4 video exactly, which means re-encoding the video stream, while keeping the audio as-is since it was good enough:
Even though I used the "-shortest" option, ffmpeg keeps going past the length of the video (which is about 15mn, and I stopped ffmpeg at around 23mn).Code:ffmpeg -ss 02:34:48 -i input.mp4 -b:v 200k -t 02:51:40 -c:v libx264 -vf scale=640:-1 -pix_fmt yuv420p -c:a copy -shortest -threads 2 -crf 20 -f mp4 output.mp4
Does someone why, and if there's a way to avoid needlessly re-encoding the audio stream as well?
Thank you.
--
Edit : I tried the "-to" option introduced in 2013, to no avail:
Code:ffmpeg -ss 02:34:48 -i input.mp4 -b:v 200k -to 02:51:40
		
			+ Reply to Thread
			
		
		
		
			
	
	
				Results 1 to 5 of 5
			
		- 
	Last edited by yetanotherlogin; 23rd Feb 2016 at 09:47. 
- 
	Are you sure you are using a newer version of ffmpeg? Use ffmpeg -version 
 
 I guess you have read http://trac.ffmpeg.org/wiki/Seeking ?
- 
	Yes, I'm using the latest and greatest. 
 
 I don't understand what this means:
 "Note that if you specify -ss before -i only, the timestamps will be reset to zero, so -t and -to have not the same effect. If you want to keep the original timestamps, add the -copytsoption."
- 
	You put '-ss 02:34:48' before the input thus ffmpeg starts at that point and the internal time stamp is now 0 at that point, so if you want to reencode from 02:34:48 to 02:51:40 you want to encode an interval of 00:16:52 and thus you should set the duration to 00:16:52 (-t 00:16:52). users currently on my ignore list: deadrats, Stears555, marcorocchini
- 
	Thanks for the info. 
 
 This worked as expected:
 Code:ffmpeg -i input.mp4 -ss 00:05:00 -b:v 200k -to 00:05:30 -c:v libx264 -vf scale=640:-1 -pix_fmt yuv420p -c:a copy -shortest -threads 2 -crf 20 -f mp4 output.mp4 
Similar Threads
- 
  cant save video on windows movie maker past 76%? please help...By arosemontages in forum Newbie / General discussionsReplies: 12Last Post: 16th Jul 2015, 08:15
- 
  VOB file displays "1 sec" length, is actually 29mins, plays full length butBy neonnebula in forum Newbie / General discussionsReplies: 2Last Post: 17th Feb 2015, 21:12
- 
  losing video length. PLEASE HELP!?By nafaan in forum Video ConversionReplies: 2Last Post: 14th May 2013, 09:11
- 
  Video and Audio different lengthBy pchan in forum AudioReplies: 3Last Post: 15th Aug 2012, 04:46
- 
  Change length of an AVI. Reduce/Increase Frame LengthBy Buzwinkle in forum Authoring (DVD)Replies: 4Last Post: 10th Aug 2011, 09:08


 
		
		 View Profile
				View Profile
			 View Forum Posts
				View Forum Posts
			 Private Message
				Private Message
			 
 
			
			
 Quote
 Quote Visit Homepage
				Visit Homepage
			 
			
