Welcome
Welcome to refracta

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!

youtube2what

Refracta Development, Scripts, etc.

Re: youtube2what

Postby lester] » Tue Feb 19, 2013 8:29 am

i've been using the new version of ffmpeg renamed avconv to convert flash files to flashfile.webm
.webm file will load using the new browsers builtin media player without the need of an external plugin.
.webm files are a container of ogg video and vorbis audio, at least the way avconv builds them.
I thought I'd mention it in case yad has an option to make .webm files too.
lester]
 
Posts: 12
Joined: Mon Feb 04, 2013 6:55 pm

Re: youtube2what

Postby fsmithred » Tue Feb 19, 2013 10:21 am

Nothing to do with yad, but webm is one of the supported formats for ffmpeg, which is what does the work in the script. What command line options do you use? I can easily add it. Any other formats I should add?
User avatar
fsmithred
 
Posts: 1987
Joined: Wed Mar 09, 2011 9:13 pm

Re: youtube2what

Postby lester] » Tue Feb 19, 2013 1:02 pm

the libav team has kept most of ffmpeg options in avconv AFAIKT

I don't add options unless I want to change res or framerate, etc.

Code: Select all
avconv -i flashfile.flv myconversion.webm


it you have an avi or something avconv wouldn't make into a webm file
I use one of the matrioska tools to convert it to mp4 first then use avonv mp4 to webm

the avconv manual says the libav team has set defaults for sane limits
but the conversion is insanely outta site
compression is outragous
the resulting stripped webm file retains enough of the original file to rebuild the original content, etc
Last edited by lester] on Tue Feb 19, 2013 1:05 pm, edited 1 time in total.
lester]
 
Posts: 12
Joined: Mon Feb 04, 2013 6:55 pm

Re: youtube2what

Postby fsmithred » Tue Feb 19, 2013 1:04 pm

Made some changes in youtube2what:
- replaced ffmpeg with avconv
- figured out how to convert to ogg audio
- added webm

Here's a piece of the script. Please take a look at the avconv command line options, and tell me if they can be improved. I don't know a lot about audio/video converting, and I just borrowed the code from julian67. (remember him?)

Should I add '-acodec copy -vcodec copy' to the oggV section? It's in most of the other video conversions.

Code: Select all
case "$format" in

   mp3)
      for MOVIE in "$@" ; do
         AUDIOOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
         avconv -i "$MOVIE" -f mp3 "$AUDIOOUT".mp3
      done ;;


   flac)
      for MOVIE in "$@" ; do
         AUDIOOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
         avconv -i "$MOVIE" -f flac "$AUDIOOUT".flac
      done ;;

   oggA)
      for MOVIE in "$@" ; do
         AUDIOOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
         avconv -i "$MOVIE" -f ogg -acodec libvorbis -vn "$AUDIOOUT".ogg
      done;;

   oggV)
      for MOVIE in "$@" ; do
         VIDOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
         avconv -i "$MOVIE" -f ogg "$VIDOUT".ogg
      done ;;

   avi)
      for MOVIE in "$@" ; do
         VIDOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
         avconv -i "$MOVIE" -b 798k -ab 128k "$VIDOUT".avi
      done ;;

   mp4)
      for MOVIE in "$@" ; do
         VIDOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
         avconv -i "$MOVIE" -acodec copy -vcodec copy "$VIDOUT".mp4
      done ;;

   mkv)
      for MOVIE in "$@" ; do
         VIDOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
         avconv -i "$MOVIE" -acodec copy -vcodec copy "$VIDOUT".mkv
      done ;;
   
   webm)
      for MOVIE in "$@" ; do
         VIDOUT=$(basename "$MOVIE" |sed 's/\(.*\)\..*/\1/')
         avconv -i "$MOVIE"  -acodec copy -vcodec copy "$VIDOUT".webm
      done ;;
User avatar
fsmithred
 
Posts: 1987
Joined: Wed Mar 09, 2011 9:13 pm

Re: youtube2what

Postby lester] » Tue Feb 19, 2013 1:23 pm

Yeah I remember julian67
I wonder where he is and who he might be logging in as these days .
Maybe it is just a poser trying to imitate him, but I swear I've seen what
I think is his style post ( pretending to be a nob, etc) at the other forum once a few weeks ago.

I can't say how to convert audio and video streams separately, I haven't gotten that far yet..

Like I edited above the avconv defaults are accurate and easy as long as you
don't need to change much about the original file.

I started doing my own oneliner for the conversion, to grab the youtube flash using youtube-dl
and drop it in it's own directory then convert the flash.flv file to flash.webm

But I need to learn a few more bash variable thingies before I can
write my own script that will grab the resulting downloaded uniquely named youtube flash file
and convert it to a filename of my choice, that avconv will add the webm extension to.

Sorry to not peek again at the script ( I did look it over before I posted)
but if, like I'm thinking you are talking about above,
If the script is converting audio and video streams seperately,
that is for a more fine tuned conversion with personal settings
and the resulting converted file may or maynot be optimized the way the guys that wrote
ffmpeg / avconv set it up to do automagically.

edit just grab a youtube flash file and convert it to webm
you'll see what I'm trying to say, I think.
lester]
 
Posts: 12
Joined: Mon Feb 04, 2013 6:55 pm

Re: youtube2what

Postby fsmithred » Tue Feb 19, 2013 3:56 pm

I took the options out of the webm line, and now it works.

For converting to mp3 or flac, I just add '-f mp3' or '-f flac' and it converts just the audio. Other than that, it's the same as video to video conversion. For ogg, I had to add '-vn' to turn off video recording, or it comes out as ogg video.
User avatar
fsmithred
 
Posts: 1987
Joined: Wed Mar 09, 2011 9:13 pm

Re: youtube2what

Postby lester] » Tue Feb 19, 2013 8:33 pm

Thanks for humouring me with the wishlist request.
I tested the script and it works the same as what I typically do with a youtube file.
Recently though I've found that some windows users are publishing HD flash content
and or post really hoggish sized flash files.
The hogs get reduced to virtually nothing when libav is finished with them.
But the HD files are still a challenge,
as they have lots of different properties that effect the
size and playability of the conversion.

I haven't really done any pure audio streams yet.
I've ripped a couple of CD's and a couple of DVD's but haven't found
time to mess around with them much afterwards.
I like taking pictures, since I don't need help from anyone else to do it.
Not that I like doing stuff on my own, I'd just never have anything to do if
I had to wait for someone else to be interested in doing the same thing I like to do.

But I take so many I rarely get a chance to look at most of them.
They are good for a quick history check.

Back to youtube2what,
thanks for helping me with the gemstone, thanks to julien67 for sharing it.
I'm certain it will provide me with many wondrous days of exploration,
now that I have a grasp of how it's supposed to work.
lester]
 
Posts: 12
Joined: Mon Feb 04, 2013 6:55 pm

Previous

Return to Discuss

Who is online

Users browsing this forum: No registered users and 0 guests

suspicion-preferred