We're converting a bunch of .RM files to .MP4 and wondered what the best way is. Here are the details:
Convert the files to H.264.
Keep the filename but add .mp4 to the end.
Also extract a JPG image of the video at about 5 seconds in for each file and name it the original filename + .jpg.
This is on a Windows system. Is there a free tool you recommend for this? Thank you.
ffmpeg is pretty much the defacto standard app for transcoding video.
http://www.ffmpeg.org/
Convert to h264/mp4:
ffmpeg.exe -i inputFile.rm -vcodec libx264 -s 320x240 -acodec libfaac outputFile.mp4
Related
A have a hand full of .avi files which I would like to convert to .mp4. Cobbling together everything I have found on the Internet, I end up with something like this:
ffmpeg -i something.avi -c:v copy -c:a copy something.mp4
What I get is playable on VLC player, but, of course, that will play anything I through at it. However, I cannot play it using QuickLook in the Finder or with the QuickTime player.
In some cases I get video, but no sound. In some other cases I get garbled video.
I am guessing that the audio or video codec inside the .avi file is incompatible with MacOS, and that the copy instruction above is not appropriate. In that case I guess that I would actually need to reencode the audio or video.
If this sounds incoherent, I admit I know very little about video files.
What would be the best settings to try to produce an MP4 which works natively on MacOS?
"What would be the best settings to try to produce an MP4 which works natively on MacOS?"
Check this useful guide.
You can try the below command as a starting point (audio track will / should be auto-detected & converted):
ffmpeg -i something.avi -c:v libx264 -crf 22 -pix_fmt yuv420p something.mp4
I have a .m2p file (which is an image file i believe that contains many images, kinda like a video of still images) that I would like to convert to any image file (preferably .png or .jpg).
Does anyone know if there is a possible way to do so?
Does anyone know how to convert these, using a script, to a different file extension essentially. Extract out all the images from a .m2p file?
Any help would be appreciated.
Figured out the answer to this.
Can simply just use ffmpeg (for Mac atleast).
Images:
To grab a still from a certain time:
ffmpeg -i video.m2p -ss 00:00:07.000 -vframes 1 thumb.png
Videos:
To convert m2p to mp4
ffmpeg -i example.m2p -f mp4 -vcodec libx264 -preset slow -profile:v main -acodec aac example.mp4 -hide_banner
Random: I used the slow preset just so it outputs a better quality video
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
I have learned through Google, that to change video containers without losing quality I can run the following command:
ffmpeg -i videofile.mkv -codec copy videofile.mp4
This has worked great for a number of video files I have. However, I am having an issue with three of them (1 mkv file and 2 avi files). When I run that command against them, the video is there, but there is no sound. There is sound in the original video file.
Any ideas how to put the video in a new container while retaining the audio track?
Thanks. Brian
The .mp4 container is not compatible with the audio codecs of the problem files. This should be evident from the logs. So the audio channels of the problem files have to be transcoded to something allowed in .mp4, eg. aac:
ffmpeg -i videofile.mkv -c:v copy -c:a aac videofile.mp4
Maybe the container mp4 it doesn’t compatible whith codec of your input video mkv and avi
By the way, you can try
ffmpeg -i videofile.mkv -c:v copy -c:a copy videofile.mp4
Check this documentation.
https://en.m.wikipedia.org/wiki/Comparison_of_video_codecs
https://trac.ffmpeg.org/wiki/Map
How can I convert audio files to mp3 with original file's audio quality?
ffmpeg -i audio.ogg -f mp3 newfile.mp3
I want to know is that code converts with same quality?
it is impossible. FFmpeg cannot search for you input file's bit rate and then cannot copy funded bit rate to output. We need to find the input file's bit rate then we need to convert to mp3. This code converts audio files to mp3 with 320 kbps bit rate.
ffmpeg -i 31352.m4a -ab 320k -f mp3 newfile.mp3