android
  #1  
Old 11-29-2010, 09:02 PM
meetooman's Avatar
meetooman meetooman is offline
Member
 
Join Date: Oct 2009
Posts: 488
Default Video encoding for the Samsung YP-P3 on Linux

I've been exploring video encoding for my Samsung P3. There are many threads about the ways to get valid video files, but I think I can add this time a feedback from a Linux user.

I have used 8 encoding tools:

Audio+video
  • Avidemux 2.5.4
  • ffmpeg SVN-r25702
  • Handbrake 0.9.4+r3549
  • Mencoder dev-SVN-r31930
Audio (aac)
  • Faac 1.28
  • neroAacEnc 1.5.3.0
Video (H.264)
  • x264 0.107.x
Multiplexer
  • MP4Box (from GPAC 0.4.5)

I need the standalone audio encoders to create the audio tracks for the command-line x264 encoder which is a video only tool. MP4Box is used to join the audio and video tracks to create a final mp4 movie file.

Working encoding combinations


I have tried to comply to the MPEG4-SP and AVC supported profiles limits, to stay under the native display resolution (WQVGA), around 500Kbps video rate and 128Kbps CBR audio rate.
Here are my working solutions list in a table format:

Code:
+-----------+--------+--------+-----------+-----+-------+
| encoder   | vcodec | acodec | container | ext | plays |
+-----------+--------+--------+-----------+-----+-------+
| avidemux  | MPEG4  | MP3    | AVI       | AVI | Yes   |
| avidemux  | XVID   | AAC    | AVI       | AVI | Yes   |
| avidemux  | XVID   | MP3    | AVI       | AVI | Yes   |
| ffmpeg    | MPEG4  | AAC    | MP4       | MP4 | Yes   |
| ffmpeg    | MPEG4  | MP3    | AVI       | AVI | Yes   |
| ffmpeg    | X264   | AAC    | MP4       | MP4 | Yes   |
| ffmpeg    | XVID   | AAC    | MP4       | MP4 | Yes   |
| ffmpeg    | XVID   | MP3    | AVI       | AVI | Yes   |
| handbrake | MPEG4  | AAC    | MP4       | M4V | Yes   |
| handbrake | X264   | AAC    | MP4       | M4V | Yes   |
| mencoder  | MPEG4  | AAC    | MP4       | MP4 | Yes   |
| mencoder  | MPEG4  | MP3    | AVI       | AVI | Yes   |
| mencoder  | X264   | AAC    | MP4       | MP4 | Yes   |
| mencoder  | XVID   | MP3    | AVI       | AVI | Yes   |
| x264      | X264   | AAC    | MP4       | MP4 | Yes   |
+-----------+--------+--------+-----------+-----+-------+
Remarks
  1. As Mencoder has trouble creating H.264/AVC valid mp4 files; MP4Box and the external audio encoders were also used to help for AVC/mp4 file. MPEG4/XVID videos entirely made by Mencoder are fine.
  2. ffmpeg provides some libx264 presets. But its baseline one was not good for the P3. So I relied on manual libx264 options.
  3. I didn't manage to get a single H.264+AVI file that the Samsung P3 could play.
  4. I've also failed trying to get any playable H.264/AVC video file from Avidemux (whatever the mp4 or avi container).
Reply With Quote

Advertisement [Remove Advertisement]

  #2  
Old 11-29-2010, 10:03 PM
electron's Avatar
electron electron is offline
Senior Member
 
Join Date: Nov 2008
Location: I would like to know too.
Posts: 828
Default

nice, thanks for the work!
I must admit that I always cheat and use the iPod Touch preset in Handbrake :P
__________________
The difference between genius and stupidity is that genius has its limits. - Albert Einstein
check out my P3 group here!
Thanks for making my P3 group the largest non-contest group on ABi!
Reply With Quote

  #3  
Old 12-09-2010, 12:11 PM
tobiasmerlin tobiasmerlin is offline
Junior Member
 
Join Date: Dec 2010
Posts: 2
Default

Sounds great, since I haven't been able to produce anything that works with neither x264 directly nor with ffmpeg (where the presets should actually be exactly the same as in x264) (just been using dumb Handbrake like most other people around here I assume...).

Could you please post at least your parameters if not your whole commandlines that worked?
Reply With Quote

  #4  
Old 12-13-2010, 09:25 PM
meetooman's Avatar
meetooman meetooman is offline
Member
 
Join Date: Oct 2009
Posts: 488
Default

Welcome to abi tobiasmerlin,
Do you use a Samsung P3 only or some other portable video players too?
I've set up a web page on my web site where you just fill a form and click to get a complete command-line. Please try it. It's a work in progress and I intend to add more options and encoders.
Reply With Quote

  #5  
Old 12-14-2010, 02:12 AM
tobiasmerlin tobiasmerlin is offline
Junior Member
 
Join Date: Dec 2010
Posts: 2
Default

The only hardware player I have is the Samsung P3. For my atom netbook I just use the fastdecode tuning
Since I know the options and what they do my interest is not so much in automatically generated commandlines, although your script seems to work quite nicely , but more in what specifically is needed for the P3. Because when I just use Baseline 3 profile and vbv limiters in x264 as suggested in numerous sources the P3 doesnt play it...

Edit: One comment on your website: Why does it say NeroAac behind the aac option when it produces no NeroAacEnc commandline but just uses the aac encoder in ffmpeg (which is said to be even worse than faac)? Seems misleading. I would expect something like this:
ffmpeg -i video audio.wav
NeroAacEnc -if=audio.wav -of=audio.mp4
ffmpeg -i video -i audio.mp4 -map 0:0 -map 1:0 -acodec copy

Last edited by tobiasmerlin; 12-14-2010 at 02:18 AM.
Reply With Quote

  #6  
Old 12-14-2010, 11:56 PM
meetooman's Avatar
meetooman meetooman is offline
Member
 
Join Date: Oct 2009
Posts: 488
Default

Quote:
Originally Posted by tobiasmerlin View Post
Edit: One comment on your website: Why does it say NeroAac behind the aac option when it produces no NeroAacEnc commandline but just uses the aac encoder in ffmpeg (which is said to be even worse than faac)? Seems misleading. I would expect something like this:
ffmpeg -i video audio.wav
NeroAacEnc -if=audio.wav -of=audio.mp4
ffmpeg -i video -i audio.mp4 -map 0:0 -map 1:0 -acodec copy
In fact it's kind of contextual information added to the label. That's why I put it in parentheses. You must read aac or faac buttons differently when you choose ffmpeg or mencoder. Maybe I should use colours to show it better:

encoder (ffmpeg/mencoder)

  • aac (aac/neroAacEnc)
  • faac (libfaac/faac)

Or maybe I should change the label by script when the encoder is selected.

Mencoder has a mp4 muxer issue, that gives a pretext to show the way to do audio and video separately. But ffmpeg alone can produce a complete file. So my idea was to show the simple way with ffmpeg and a more complex with mencoder providing 2 audio options for each encoder. 4 combinations with 2 buttons.
It's difficult to balance simplicity and completion. Adding too much buttons and options would kill the purpose of this tool.

Thank you for the feedback, it is always important to know how people read the UI you create.
Reply With Quote

  #7  
Old 12-19-2010, 03:30 PM
meetooman's Avatar
meetooman meetooman is offline
Member
 
Join Date: Oct 2009
Posts: 488
Default

Quote:
Originally Posted by tobiasmerlin View Post
Could you please post at least your parameters if not your whole commandlines that worked?
I've found the syntax to create a ffmpeg AVC baseline preset that the Samsung P3 will play. I must add a parameter to the flags2 for the player to be able to use it: -flags2 -bpyramid.
A complete command-line could be for a 4:3 mpg video to encode in avc+aac->mp4 at a 300kbps video bitrate and 128kbps audio bitrate:

Quote:
ffmpeg -y -i input_video.mpg -acodec aac -ab 128k -ac 2 -strict experimental -s 360x270 -aspect 4:3 -vcodec libx264 -vpre fast -vpre baseline -flags2 -bpyramid -b 300k -maxrate 768k -bufsize 2M -threads 2 -f mp4 output_video.mp4
Reply With Quote

Reply

Tags
encoding, linux, p3, samsung, video

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 07:57 AM.