TEDding from the car – gPodder video Plugin for Rockbox April 7, 2011
Posted by GuySoft in Crictor, diy, Electronics, ipod, ITU, linux, open source, podcast, programming, python.Tags: car, diy, ffmpeg, gpodder, mp4, mpeg, open source, python, rockbox, TED, video
trackback
Hey all,
After a few weeks of bouncing emails with Thomas Perl I am happy to announce that we have a working plugin for his wonderful podcast application called gPodder. With this plugin installed, any mp4 video podcast that is downloaded with gPodder is automatically converted to a format playable by rockbox MPEG player plugin. Effectively meaning seamless sync of video podcasts to any rockbox enabled device. I am specifically using the Sansa fuze player, but just changing the screen resolution at the top of the plugin should make it work with any other rockbox device, and with the right screen size. The final product for me of all this technical stuff is that I can listen to TED lectures in the car. Or using the verb was coined by my friend Uzair “TEDding” from my car.
How to Install
- First you should have gPodder installed (available also as “apt-get install gpodder” or any other distribution install equivalent).
- Second you will need these packages installed too:
apt-get install python-kaa-metadata ffmpeg python-dbus
- Now all that is left is to copy this script to
mkdir -p ~/.config/gpodder/hooks/ cp rockbox_mp4_convert.py ~/.config/gpodder/hooks/
- If your are using a different player from the Sansa Fuse, modify the first lines to your screen resolution:
DEFAULT_DEVICE_WIDTH = 224.0 DEFAULT_DEVICE_HEIGHT = 176.0
make sure to include the .0 at the end.
- Thats it! Now each time video is download, for example from the TEDTalks Video Podcast it would be converted on arrival, and relinked as the file to be synced.
As usual, I would love to hear feedback from users and suggestions.
Is gPodder download video from TED with the subtitles?
The subtitles is important part of TED.
No, Thats part of the youtube service I think.
Anyway subtitles are kinda useless when driving.
Technically if you can create a podcast feed with rendered subtitles off youtube it would work.
This is interesting. I wonder if it is possible to (somehow) keep the original file and only sync the transcoded one, or do the transcode in the sync operation.
That way it would be possible to watch the original file on the PC, or the smaller one on the Sansa (I have an e280).
It would require a lot of playing with hooks, or redoing part of gpodder. The problem is gpodder holds only one copy of each file. If you want to do something else you will need some extra layer of management.
Perhaps you could re-use the current hook to generate a separate RSS feed, with the transcoded files, that might work.
Hi,
I’m the maintainer of the gPodder hook repository. At the moment I’m trying to add some tests for every hook. But I have problems with your rockbox hook.
When I try to convert http://download.ted.com/talks/BenGoldacre_2011G.mp4 on Ubuntu 11.10 I get the following error:
ffmpeg version 0.7.2-4:0.7.2-1ubuntu1, Copyright (c) 2000-2011 the Libav developers
built on Oct 2 2011 15:13:26 with gcc 4.6.1
configuration: –extra-version=’4:0.7.2-1ubuntu1′ –arch=amd64 –prefix=/usr –enable-vdpau –enable-bzlib –enable-libgsm –enable-libschroedinger –enable-libspeex –enable-libtheora –enable-libvorbis –enable-pthreads –enable-zlib –enable-libvpx –enable-runtime-cpudetect –enable-vaapi –enable-gpl –enable-postproc –enable-swscale –enable-x11grab –enable-libdc1394 –enable-shared –disable-static
WARNING: library configuration mismatch
avutil configuration: –extra-version=’4:0.7.2.1ubuntu1′ –arch=amd64 –prefix=/usr –enable-vdpau –enable-bzlib –enable-libgsm –enable-libschroedinger –enable-libspeex –enable-libtheora –enable-libvorbis –enable-pthreads –enable-zlib –enable-libvpx –enable-runtime-cpudetect –enable-vaapi –enable-libopenjpeg –enable-gpl –enable-postproc –enable-swscale –enable-x11grab –enable-libdirac –enable-libmp3lame –enable-librtmp –enable-libx264 –enable-libxvid –enable-libvo-aacenc –enable-version3 –enable-libvo-amrwbenc –enable-version3 –enable-libdc1394 –enable-shared –disable-static
avcodec configuration: –extra-version=’4:0.7.2.1ubuntu1′ –arch=amd64 –prefix=/usr –enable-vdpau –enable-bzlib –enable-libgsm –enable-libschroedinger –enable-libspeex –enable-libtheora –enable-libvorbis –enable-pthreads –enable-zlib –enable-libvpx –enable-runtime-cpudetect –enable-vaapi –enable-libopenjpeg –enable-gpl –enable-postproc –enable-swscale –enable-x11grab –enable-libdirac –enable-libmp3lame –enable-librtmp –enable-libx264 –enable-libxvid –enable-libvo-aacenc –enable-version3 –enable-libvo-amrwbenc –enable-version3 –enable-libdc1394 –enable-shared –disable-static
libavutil 51. 7. 0 / 51. 7. 0
libavcodec 53. 5. 0 / 53. 5. 0
libavformat 53. 2. 0 / 53. 2. 0
libavdevice 53. 0. 0 / 53. 0. 0
libavfilter 2. 4. 0 / 2. 4. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 52. 0. 0 / 52. 0. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘/home/bernd/Downloads/BenGoldacre_2011G.mp4’:
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2011-09-28 16:18:20
title : TED:Ben Goldacre (2011 Global)
artist : TED
date : 2011
album : TEDTalks
comment : To learn more about this speaker, find other TEDTalks, and subscribe to this Podcast series, visit http://www.TED.com Feedback: tedtalks@ted.com
genre : Podcast
Duration: 00:14:19.80, start: 0.153846, bitrate: 69 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 320×180 [PAR 1:1 DAR 16:9], 39 kb/s, 13 fps, 13 tbr, 13 tbn, 26 tbc
Metadata:
creation_time : 2011-08-05 17:25:34
Stream #0.1(und): Audio: aac, 24000 Hz, mono, s16, 23 kb/s
Metadata:
creation_time : 2011-09-28 16:18:20
[buffer @ 0x1c352e0] w:320 h:180 pixfmt:yuv420p
[scale @ 0x1c3b400] w:320 h:180 fmt:yuv420p -> w:224 h:125 fmt:yuv420p flags:0x4
[mpeg2video @ 0x1c2d9a0] MPEG1/2 does not support 12/1 fps
Output #0, mpeg, to ‘/home/bernd/Downloads/BenGoldacre.mpg’:
Stream #0.0(und): Video: mpeg2video, yuv420p, 224×125 [PAR 1:1 DAR 224:125], q=2-31, 500 kb/s, 90k tbn, 12 tbc
Metadata:
creation_time : 2011-08-05 17:25:34
Stream #0.1(und): Audio: libmp3lame, 44100 Hz, 2 channels, s16, 192 kb/s
Metadata:
creation_time : 2011-09-28 16:18:20
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.0 – maybe incorrect parameters such as bit_rate, rate, width or height
This is the command you use in the hook script:
ffmpeg -r 13 -y -i BenGoldacre_2011G.mp4 -s 224×125 -vcodec mpeg2video -b 500k -ab 192k -ac 2 -ar -r 13 44100 -acodec libmp3lame BenGoldacre_2011G.mpg
Hey, it seems like you ordered the command values wrong there.
the -ar command needs to have the 44100 parameter after it.
Here is the line in the plugin’s source:
FFMPEG_OPTIONS = ‘-vcodec mpeg2video -b 500k -ab 192k -ac 2 -ar 44100 -acodec libmp3lame’
You should use:
ffmpeg -y -i input.mp4 -s 224×125 -vcodec mpeg2video -b 500k -ab 192k -ac 2 -ar 44100 -acodec libmp3lame output.mpg
oh sorry, the command in the source is correct. I tried it with the two “-r 13” option after I googled for the error. This was my fault I add manually
The file “http://download.ted.com/talks/BenGoldacre_2011G.mp4” didn’t work for me with your command:
ffmpeg -y -i BenGoldacre_2011G.mp4 -s 224×126 -vcodec mpeg2video -b 500k -ab 192k -ac 2 -ar 44100 -acodec libmp3lame output.mpg
But the file “http://video.ted.com/talk/podcast/2011U/Rolex/MattCutts_2011U.mp4” works still fine
when i try the second command on step 3 i get
ubuntu@ubuntu:~$ cp rockbox_mp4_convert.py ~/.config/gpodder/hooks/
cp: cannot stat ‘rockbox_mp4_convert.py’: No such file or directory
Peter,
did you download https://github.com/guysoft/gpodder-hook-scripts/blob/master/rockbox_mp4_convert.py ?
Would be hard to copy it if its not there 🙂
Thanks, But I have another question
I have recently switched to Windows and was wondering if there was a way to get the plugin to work in the windows version
Thanks for your developing,
Peter
Its possible if you disable the notifications that rely on stuff windows does not have, and make sure executing “ffmpeg” in your windows cmd actually runs ffmpeg.
BTW: when you reply on wordpress its usually best to press the “reply” button right under the message you wish to reply to. Because that way it leaves a thread people can follow.