![]() |
Encoding videos for N9 (using CLI tools)
I was playing with ffmpeg on my laptop trying to figure out good settings in encoding video for the N9. Settings that would also play nicely with Harmattan's default video player and support Dolby 5.1 surround when possible. I used Nokia Developer Wiki as a reference.
Encoding/Transcoding For x264 baseline profile and 6 channel ac3 audio (ca. 700MB/h): Code:
$ ffmpeg -i infile.mp4 -s 854x480 -r 25 -g 25 -vcodec libx264 -vb 1536k -vprofile baseline -acodec ac3 -ab 192k -ac 6 outfile.mp4 Code:
$ ffmpeg -i infile.mp4 -s 854x480 -r 25 -g 25 -vcodec libx264 -vb 1024k -vprofile baseline -acodec ac3 -ab 192k -ac 6 outfile.mp4 One method to rip a DVD is to concatenate VOB files and pipe the output to ffmpeg: Code:
$ cat VTS_02_1.VOB VTS_02_2.VOB VTS_02_3.VOB | ffmpeg -i - -r 25 -g 25 -vcodec libx264 -vb 1536k -vprofile baseline -acodec ac3 -ab 192k -ac 6 ~/outfile.mp4 If you want to remove black borders when ripping a DVD you can play a VOB file using "mplayer -vf cropdetect" and simply copy & paste the crop filter string from its output (for example -vf crop=704:432:10:72) into your ffmpeg command. Sometimes DVDs have several audio tracks for different languages and by default ffmpeg rips only the first one. If you need to select another audio track you can do that by using -map flags. For more information see: http://howto-pages.org/ffmpeg/#map Legend Flags in use (as of ffmpeg v.1.0.1): -i = input file * -s = video resolution -r = frame rate ** -g = I-frame interval (frames) *** -vcodec = video codec -vb = video bit rate -vprofile = video profile **** -acodec = audio codec -ab = audio bit rate -ac = audio channels * Most video formats/containers will work as input. ** Practical framerate limits for smooth playback are 30fps@854x480 and 25fps@1280x720. [thanks thedead1440] *** More frequent I-frames improve error correction and seek performance at cost of filesize. (The Nokia Developer Wiki recommends one I-frame/s.) **** -vpre in older versions, you can also try -profile Any improvements/corrections/alternative methods are more than welcome. |
Re: Encoding videos for N9 (using CLI tools)
Can't promote ffmpeg enough as the tool to use when encoding. Thanks for the clear instructions.
|
Re: Encoding videos for N9 (using CLI tools)
why not suggest a patent free output format ? like ogv theora or webm ? but will those codec be hardware accelerated ?
-- http://rzr.online.fr/q/codec |
Re: Encoding videos for N9 (using CLI tools)
Quote:
Using patent free formats would be better in every other respect. I hope someone wants to experiment with them to find out the best quality that we can play on our N9's and add to this thread. |
Re: Encoding videos for N9 (using CLI tools)
ladoga,
For the second command I think you mean to put it as -vb 1024k instead of 1536k Edit: I know you hate resolutions higher than the stock but i tried and it works perfectly fine with 1280x720; will now attempt to use movgrab to download a file and encode it to 720p baseline at the same time so that one file can be played across your desktop and device... Edit 2: I missed out on the "" marks in the movgrab stage and it wasn't working but it works now :D Code:
~ $ X=input.mp4 ; movgrab -o "$X" -f mp4:1280x720 "http://www.youtube.com/watch?v=xxxxxxx" ; ffmpeg -i $X -s 1280x720 -r 25 -g 25 -vcodec libx264 -vb 1024k -vprofile baseline -acodec ac3 -ab 192k -ac 6 output.mp4 ; rm -rf $X Edit 3: Update second edit with a cleaner command and changed fps to 25fps with 1 I-frame being created per second as per ladoga's method which results in smoother seeking in the video. Edit 4: Just realized that the command in edit 2 says 1024k for the video bitrate; it can be safely increased to 1536k as per ladoga's first post. |
Re: Encoding videos for N9 (using CLI tools)
Seems like burning srt subtitles into movies using ffmpeg is possible: http://ffmpeg.org/trac/ffmpeg/wiki/H...%20the%20video
Though with v.1.0.1 trying "-vf subtitles=whatever.srt" spits out "No such filter: 'subtitles'" in bold red :) |
Re: Encoding videos for N9 (using CLI tools)
Quote:
I'm using 7:201212231432-git-1 which seems to be after the 29/11/12 date the man page states for 'subtitles' support... I had followed the instructions here to get that version... Edit: Hmmm I think I spoke too early; I first tried with a .sub file everything processed but at the end it sayed subtitle=0 so then tried with a .srt file which was detected but the resulting output.avi for some reason doesn't playback in VLC or GNOME Mplayer... Again in the video that used the .srt file the output said subtitle:0 Another thing I noticed was the dramatic down-sizing of the file; my input.avi was 732.4MB but the output.avi came to only a paltry 288.9MB... I have used it just like in the manpage: Code:
ffmpeg -i input.avi -vf subtitles=/path/to/.srt/file output.avi Edit 2: Just noticed when doing the above command this is what I got exactly: Neither PlayResX nor PlayResY defined. Assuming 384x288 So it means the output.avi has to be defined? Will try later when I have some time on my hands :D |
Re: Encoding videos for N9 (using CLI tools)
Quote:
Quote:
I think you told earlier about audio video sync problems when playing some files on N9 with KMPlayer using MPlayer as backend. Here is a likely remedy for that. Try autosync=30 in ~/.mplayer/config to use more agressive a/v sync. Also you can look for "mc" flag (sets maximum allowed correction in seconds) in the documentation. |
Re: Encoding videos for N9 (using CLI tools)
Thanks! Just converted some videos to "x264 baseline profile and 6 channel ac3 audio" and they work fine on N9. Just I found command line ffmpeg to difficult to use and used WinFF user interface: http://winff.org/html_new/downloads.html where I added custom preset as follows:
Preset Name: NokiaN9 Preset Label: Nokia N9 Preset command line parameters: $ -s 854x480 -r 25 -g 25 -vcodec libx264 -vb 1536k -vprofile baseline -acodec ac3 -ab 192k -ac 6 Output file extension: mp4 |
Re: Encoding videos for N9 (using CLI tools)
Quote:
- ffmpeg -i input.mp4 -i input.srt -scodec copy output.mp4 - with a bonus of 33% lower compared to the original file :D |
Re: Encoding videos for N9 (using CLI tools)
Great Thread!
Would someone like to add an Profile for N9 for software called "XMediaRecode" ? It's an free converter software and it would be very easy to manage. |
Re: Encoding videos for N9 (using CLI tools)
Quote:
|
Re: Encoding videos for N9 (using CLI tools)
Quote:
|
All times are GMT. The time now is 11:21. |
vBulletin® Version 3.8.8