Why does SSA/ASS not accept timecodes larger than 9:59:59.99 - subtitle

I have a SRT file which contain timecodes > 100 hours (e.g. 123:45:67.891; hhh:mm:ss:fff). Now I stumpled upon this issue when converting my SRT to ASS using ffmpeg
ffmpeg -i subs.srt styled.ass
In the ASS file, all the timecodes in the SRT that are equal/bigger than 10:00:00.00 were changed to 9:59:59.99. First thought ffmpeg was doing something strange, but I read that the format for ASS is h:mm:ss.ff. Now I'm wondering why is this? Why doesnt it support hh:mm:ss.fff like SRT does?

Related

FFMPEG input a lot .ts files with increment

I'm a newbie in FFMPEG and know a little about streams.
There is a site where I want to get a video stream. There is an m3u8 that contains current .ts stream as the last row. Each .ts file during 6 seconds and has name like a 'media_3482026' where 3482026 is increment each 6 seconds(each chunk).
I think ffmpeg can create names like a 'media_[increment]' for input. How can I do it? Or may be there is any better way?
It's queries(may be it helps)
ffmpeg -i "media_%i.ts" -codec copy media.mp4

Using ffmpeg to convert an SEC file

I need to convert an SEC file into any video format that I can share and/or upload to Youtube. MP4, etc.
I'm a complete newbie at all things terminal. I've tried:
ffmpeg -i video.sec video.mp4
ffmpeg -i video.sec -bsf:v h264_mp4toannexb -c:v copy video.avi
ffmpeg -i video.sec -b 256k -vcodec h264 -acodec aac video.mp4
I don't understand what any of these mean, they're just examples I found online. However, whatever I try returns this error:
Invalid data found when processing input
Any thoughts? Thanks!
I had to add the following option so it would skip the SEC's custom header.
-skip_initial_bytes 48
i know this is old, but i was trying to figure this out as well, what ended up finally working for me was this command.
./ffmpeg -f h264 -i INPUT.sec -filter:v "setpts=4*PTS" OUTPUT.avi
the -f h264 was the part i was missing. and the -filter:v "setpts=4*PTS" part is to slow it back down to the original speed. you can also change the .avi at the end to whichever format works best for you.
i hope this helps someone out :)
OK, just to clear up some recent threads…
The Samsung DVR used here was an SRD-440. RB kindly sent me a file to test and he sent me a .BU file with an associated .db2 file. This was a bit of a surprise as in all older Samsung DVR’s, the .bu files can only be played back in the DVR. I mentioned this here, https://spreadys.wordpress.com/2014/07/21/ifsec-samsung-exports/
It appears that Samsung have caught on, and the BU file is now playable due to it being a H264/AVC Stream conforming to a standard profile. I have updated the IFSEC Post mentioned above to highlight this change.
Back to RB’s stream and the challenge was to get these files viewable in WMV format. They were all field based, at 704×288.
The speed of playback is controlled by the Samsung software, using the .db2 file. As such, the metadata and timing information in the video stream was wrong. This caused speed issues and then quality issues when attempting to correct this.
As a result, I found it necessary to force an input rate and generate a new Presentation Time Stamp BEFORE the input file.
The following FFmpeg string did the job…
ffmpeg -r 12 -fflags genpts -i FILE.bu -vf scale=704:528 -sws_flags lanczos -q:v 2 FILE.wmv
Remember, this is for preview – analysis would be completed differently due to the scaling, the interpolation method, and the WMV compression!
As its likely that RB may have quite a few .bu files in a folder, I placed this into a batch file to transcode the whole lot within a few minutes… more on batch files coming in a new post soon!
https://spreadys.wordpress.com/2014/07/21/ifsec-samsung-exports/
or
ffmpeg -i (name of file).sec (name of final file).mp4
ffmpeg -i (name of file).sec -filter:v "setpts=3.3*PTS" (name of final_file).mp4

ffmpeg - how to copy exactly the video settings except for the resolution

I want to change the resolution of my .flv file. I have tried "ffmpeg -i file.flv -s 1280x720 -acodec copy file2.flv", but the output file has different video encoding settings. I have added "-vcodec libx264" which makes the output settings closer to the input settings, but there are still little differences such as fps. I realize that I could probably use mediainfo and figure out how to format that information in a way ffmpeg can use, but that seems like a very clunky solution. Is there a way for ffmpeg to copy the encoding settings from the input and apply them to the output with a resolution change?

ffmpeg: concat videos and images

I have 2 videos (same resolution, same encoding) files that I want to concat and I want to insert some text for 3 seconds between them, as a splitter. I'm doing this with ffmpeg on Windows.
Optional ideas that I would be interested in:
avoid reencoding the video in the process
having a fade in / fade out at the intersection of each part
For now, I made the text as an image (but I am open to other suggestions). Let's say I have:
video1.mp4: 6:33
splitter.png (same resolution as video1.mp4)
video2.mp4: 16:44
I have tried a few things, but I always end up with the same problem: the video is 23:20 (video1 + 3 seconds + video2), but the 3 seconds gap is just the last video1 frame frozen instead of my image/text...
Any Idea what I did wrong or how I should achieve this?
Here is what I tried so far:
Method 1: image to video
Turn the image into a 3 seconds mp4 film, then concat (demuxer) it with the others:
ffmpeg -loop 1 -f image2 -i splitter.png -r 30 -t 3 splitter.mp4
ffmpeg -f concat -i input.txt -codec copy output.mp4
Where the input.txt looks like:
file 'E:\video1.mp4'
file 'E:\splitter.mp4'
file 'E:\video2.mp4'
The content of splitter.png is visible in the splitter.mp4, but not in the output.mp4. Also I'm not entirely sure the splitter.mp4 respects the exact same encoding as the 2 videos, and I don't know how to verify that.
Method 2: insert image frames
Directly run the concat (demuxer) 90 times (30fps -> 3 seconds) on the image
ffmpeg -f concat -i input.txt -codec copy output.mp4
Where the input.txt looks like:
file 'E:\video1.mp4'
file 'E:\splitter.png'
...
file 'E:\splitter.png'
file 'E:\video2.mp4'
Edit: possible solution?
Since all I'm doing is screencasting, I might as well screencast my splitter image. This way I would be sure of the audio & video encoding and wouldn't have any problem merging and it wouldn't need any reencoding... I know it might sound dumb, but it would probably do the trick...
Note: I didn't have try it, since I already worked through Openshot.
My guess is this is all a codec issue -- the PNG turned MP4 is probably not the same codec as your real MP4s.
Try this -- concatenation of files of different codecs.

Convert streaming MPEG-4 raw data to H.264

I've got a Sony network camera (SNC-RZ25N) that I am trying desperately to get data from in some meaningful format. The documentation says it sends MPEG-4 raw data, but is not more specific than than. I can capture a segment of the stream using curl ( http://techhead.biz/media/tsv.m4v ) and it will play using VLC and ffplay (though it plays too fast in ffplay).
After a day and a half of tinkering, I just discovered that I cannot use ffmpeg to convert this stream directly. For one, the only way ffmpeg accepts piped data as input (that I'm aware of) is in the 'yuv4mpegpipe' format.
I tried piping to ffmpeg using 'm4v' as the specified format, but it seems to want to read the entire stream before it begins processing.
Anyone know how I can do this? Using commandline tools? Open source libraries in ANY programming language? Simpler solutions are preferred, but any working solution would be great.
It appears mplayer can play your m4v file over HTTP, and at least with your sample file this works:
mkfifo /tmp/fifo
mplayer -benchmark -vo yuv4mpeg:file=/tmp/fifo http://techhead.biz/media/tsv.m4v
ffmpeg -f yuv4mpegpipe -i /tmp/fifo -vcodec libx264 -vpre libx264-hq /tmp/foo.mp4
(-benchmark tells mplayer to ignore frame duration, might or might not be needed)
Alternatively, with just mencoder:
mencoder -o /tmp/foo.avi -of avi -ovc x264 -x264encopts bitrate=250 http://techhead.biz/media/tsv.m4v
Finally, if you don't actually need H.264, you could just put the existing MPEG-ES data in whatever container format you need; MP4Box might be able to do this, and ffmpeg and mencoder can if they support the output format.

Resources